#include<stdio.h> #include<stdlib.h> int main(){ int H1,H2,M1,M2,T1,T2,temp,i,j; while(scanf("%d:%d\n%d:%d",&H1,&M1,&H2,&M2)!=EOF){ int count=0; T1=H1*60+M1; T2=H2*60+M2; if(T1>T2){ temp=T1; T1=T2; T2=temp; } for(i=T1;i<=T2;i++){ for(j=2;j<i/60*2500+i%60;){ if((i/60*2500+i%60)%j==0) break; else{ if(j==i/60*2500+i%60-1) count++; j++; } } } printf("%d\n",count); } } |
Double click to view unformatted code.