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 1196. History Exam

What's wrong with my program?
Posted by nut_nic 24 Sep 2004 23:36
I got Wrong Answer #1 what is it?

#include <stdio.h>
main(){
 unsigned long t[100],s[100];
 int ct,cs,c,c2,a;
 a=0;
 scanf("%i",&ct);

 for(c=0;c<ct;c++){
  t[c]=0;
  scanf("%ld",&t[c]);
 }

 scanf("%i",&cs);

 for(c2=0;c2<cs;c2++){
 s[c2]=0;
  scanf("%ld",&s[c2]);
 }

 for(c=0;c<cs;c++){
  for(c2=0;c2<ct;c2++){
   if(t[c2]==s[c]){ a++; }
  }
 }
 printf("%i",a);
 return 0;
}



in C language.
Re: What's wrong with my program?
Posted by Razvan Brezulianu 8 Sep 2006 14:58
The limit is too small you shuold put unsigned long