View Code of Problem 119

#include<bits/stdc++.h>
using namespace std;
const int MAXX =1000010;
bool isvi[MAXX];
void count(){
	isvi[1]=0;
	for(int i=2;i<MAXX;i++){
		isvi[i]=0;
	}
	for(int i=2;i*i<MAXX;i++){
		if(!isvi[i]){
			for(int j=i*i;j<=MAXX;j+=i){
				isvi[j]=1;
			}
		}
	}
}
int main(){
	int d=0;
	int N;
	count();
	while(cin>>N){
		d++;
		if(!isvi[N]){
			printf("Case #%d: I'm richer than any one",d);
			cout<<"\n";
		}
		else{
			printf("Case #%d: What a fxcking day",d);
			cout<<"\n";
		}
	}
}

Double click to view unformatted code.


Back to problem 119