CodeFoeces-735A

题目

原题链接:A. Ostap and Grasshopper

题意

有一个蚂蚱,要跳到目的地,每次跳k步,问能否到达目的地。因为每次固定跳k步,因此若目的地和起始地的距离差小于k则无解,否则模拟。

代码

#include
using namespace std;
int main() {
    int n,k,g,t;
    char s[100];
    scanf("%d%d",&n,&k);
    scanf("%s",s);
    for(int i=0; i

你可能感兴趣的:(CodeFoeces-735A)