View Code of Problem 120

#include<stdio.h>
bool sushu(int m){
	for(int i=2;i<(m/2+1);i++){
		if(m%i==0){
			return false;
		}
	}
	return true;
}
int main(){
	int sh,sm,eh,em,s,e,n,i,j,H,M;
	while(scanf("%d:%d %d:%d",&sh,&sm,&eh,&em)!=EOF){
		n=0;
		s=sh*60+sm;
		e=eh*60+em;
		for(i=s;s<=e;s++){
			H=s/60;
			M=s%60;
			if(sushu(H*2500+M)){
				n++;
			}
		}
		printf("%d\n",n);
	}
}

Double click to view unformatted code.


Back to problem 120