View Code of Problem 120

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

Double click to view unformatted code.


Back to problem 120