View Code of Problem 120

#include<stdio.h>
int main()
{
    int h1,h2,m1,m2,s,count;
    while(scanf("%d:%d %d:%d",&h1,&m1,&h2,&m2)!=EOF){
        int t1=h1*60+m1;
        int t2=h2*60+m2;
        int s=0;
        int count=0;
        for(int i=t1;i<=t2;i++){
            int a=i/60;
            int b=i%60;
            int flag=1;
            s=a*2500+b;
            for(int z=2;z*z<=s;z++){
                if(s%z==0){
                    flag=0;
                    break;
                }
            }
            if(flag==1){
            count++;
            }
        }
        printf("%d\n",count);
    }

}

Double click to view unformatted code.


Back to problem 120