View Code of Problem 120

#include<iostream>
#include<math.h>
int zhishu(int n){
	for(int i=2;i<n;i++){
		if(n%i==0){
			return 1;
		}
	}
	return 0;
}
using namespace std;
int main(){
	int m;
	int s;
	int m1;
	int s1;
	while(scanf("%d:%d",&m,&s)!=EOF){
          scanf("%d:%d",&m1,&s1);
		  int sum=m1*2500+s1;
		  int j=0;
		  for(int i=m*2500+s;i<=sum;i++){
		  	if(zhishu(i)==0)
		  	j++;
		  }
		  	cout<<j<<endl; 
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 120