View Code of Problem 119

#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>

using namespace std;
typedef long long ll;
bool isprime[10000000]={0};//flase sushu true no suhu;
void findprime(){
	isprime[1]=true;
	for(ll i=2;i<10000000;i++){
		if(!isprime[i]){
			for(ll j=i+i;j<10000000;j=j+i){
				isprime[j]=true;
			}
		}
	}
}


int main(){
	findprime();
	ll n;
	int count=0;
	while(cin>>n){
		count++;
		if(!isprime[n])
			cout<<"Case #"<<count<<": I'm richer than any one"<<endl;
		else
			cout<<"Case #"<<count<<": What a fxcking day"<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 119