Problem:
Score: 300 points

Problem Statement

AtCoder Mart sells 1000000 of each of the six items below:

Riceballs, priced at 100 yen (the currency of Japan) each

Sandwiches, priced at 101 yen each

Cookies, priced at 102 yen each

Cakes, priced at 103 yen each

Candies, priced at 104 yen each

Computers, priced at 105 yen each

Takahashi wants to buy some of them that cost exactly X yen in total.
Determine whether this is possible.

(Ignore consumption tax.)

Constraints

1 \leq X \leq 100000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

If it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.

Sample Input 1

615

Sample Output 1

1

For example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.

Sample Input 2

217

Sample Output 2

0

No set of items costs 217 yen in total.

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>

int main(void){
 int X,N0,N1,N2,N3,N4,N5,flag=0;
 scanf("%d",&X);
 for(N0=0;N0<=25;N0++){
  for(N1=0;N1<=25;N1++){
   for(N2=0;N2<=25;N2++){
    for(N3=0;N3<=25;N3++){
     for(N4=0;N4<=25;N4++){
      for(N5=0;N5<=25;N5++){
       if(X==100*N0+101*N1+102*N2+103*N3+104*N4*105*N5){flag=1;}
      }
     }
    }
   }
  }
 }
 if(flag==1){printf("%d\n",flag); return 0;}
 for(N0=26;N0<=50;N0++){
  for(N1=26;N1<=50;N1++){
   for(N2=26;N2<=50;N2++){
    for(N3=26;N3<=50;N3++){
     for(N4=26;N4<=50;N4++){
      for(N5=26;N5<=50;N5++){
       if(X==100*N0+101*N1+102*N2+103*N3+104*N4*105*N5){flag=1;}
      }
     }
    }
   }
  }
 }
 if(flag==1){printf("%d\n",flag); return 0;}
 for(N0=51;N0<=75;N0++){
  for(N1=51;N1<=75;N1++){
   for(N2=51;N2<=75;N2++){
    for(N3=51;N3<=75;N3++){
     for(N4=51;N4<=75;N4++){
      for(N5=51;N5<=75;N5++){
       if(X==100*N0+101*N1+102*N2+103*N3+104*N4*105*N5){flag=1;}
      }
     }
    }
   }
  }
 }
 for(N0=76;N0<=100;N0++){
  for(N1=76;N1<=100;N1++){
   for(N2=76;N2<=100;N2++){
    for(N3=76;N3<=100;N3++){
     for(N4=76;N4<=100;N4++){
      for(N5=76;N5<=100;N5++){
       if(X==100*N0+101*N1+102*N2+103*N3+104*N4*105*N5){flag=1;}
      }
     }
    }
   }
  }
 }
 if(flag==1){printf("%d\n",flag); return 0;}
 printf("%d\n",flag);
 return 0;
}