View Code of Problem 119

#include<bits/stdc++.h> //119题目 
using namespace std;

int prime(int x){
	if(x==1)
		return 1;
	if(x==2||x==3){
		return 1;
	}	
	if(x>3){
		for(int i=2;i<=sqrt(x);i++){
			if(x%i==0){
				return 0;
			}
		}
		return 1;
	}
}
int main(){
	int t=0;
	int i=1;
	while(cin>>t){
		
		if(prime(t)==1){
			cout<<"Case #"<<i<<": I'm richer than any one"<<endl;
			i++;
		}
		else{
			cout<<"Case #"<<i<<": What a fxcking day"<<endl;
			i++;
		}
	}
}

Double click to view unformatted code.


Back to problem 119