#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int h1,m1,h2,m2,t1,t2,t3,h,m,time,i,j; while(scanf("%d:%d",&h1,&m1)!=EOF){ scanf("%d:%d",&h2,&m2); t1=h1*60+m1; t2=h2*60+m2; int count=0; for(i=t1;i<=t2;i++){ h=i/60; m=i%60; t3=h*2500+m; int flag=0; //int k=sqrt(t3); for(j=2;j<t3;j++){ if(t3%j==0){ flag=1; break; } } if(flag==0){ count++; } } printf("%d\n",count); } } |
Double click to view unformatted code.