ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1191. Catch the thief!

Fender_moo What should I do. Can you give me some test. [2] // Problem 1191. Catch the thief! 2 May 2006 20:15
I've got WA on case 10.
plz help me.
#include<stdio.h>
int main(){
....int n,k,i,dis;
....scanf("%d%d",&dis,&n);
....for(i = 0;i < n;i++){
........scanf("%d",&k);
........if(dis != k) dis -= k;
........if(dis < 0){printf("YES"); return 0;}
........if(dis % k != 0) dis += k - dis%k;
....}
....printf("NO");
....return 0;
}

Edited by author 02.05.2006 23:21
Change (dis != k) to (dis % k != 0) and you'll get AC.
Good luck ;)
Thank you very much!!
Now I got AC.