View Code of Problem 119

#include<iostream>
#include<cstring>
#include<math.h>
using namespace std;
int zhishu(int n)
{
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0){
			return 0;
		}
	}
	return 1;
}
int main(){
	int n;
	int k=0;
	while(scanf("%d",&n)!=EOF){
		k++;
		 if(zhishu(n)==1){
		 	printf("Case #%d: I'm richer than any one\n",n);
		 }else{
		 	printf("Case #%d: What a fxcking day\n",n);
		 } 
	} 
	return 0;
} 

Double click to view unformatted code.


Back to problem 119