View Code of Problem 120

#include<stdio.h>
int isshu(int n){
int i;
for(i=2;i<n;i++)
  if(n%i==0)
	  break;
if(n==i)
return 1;
else 
return 0;
}
int main(){
int h1,h2,m1,m2,sum1,sum2,n;
while(scanf("%d:%d %d:%d",&h1,&m1,&h2,&m2)!=EOF){
sum1=h1*2500+m1;
sum2=h2*2500+m2;
n=0;
while(sum1<=sum2){
   if(isshu(sum1)) n++;
   m1++;
   if(m1==60){
     m1=0;
     h1=h1+1;
   }
sum1=h1*2500+m1;
}
printf("%d\n",n);
} 
}

Double click to view unformatted code.


Back to problem 120