Sponsors

Tag: problem: (A) Ostap and Grasshopper Solve in C/C++

Codeforces Round #382 (Div....

  #include<stdio.h> int b,d; int main(){ int i,s,n,k,t; scanf("%d%d",&n,&k); char x; for(i=1;i<=n;i++){ scanf(" %c",&x); if(x=='G')s=i; if(x=='T')t=i; if(x=='#')b=1; } for(i=s;i<=n;i+=k){ if(b) break; d=1; } for(i=s;i>=1;i-=k){ if(b) break; d=1; } if(d) printf("YES"); else printf("NO"); }

Advertisement

spot_img