View Code of Problem 119

#include<stdio.h>
#include<math.h>
int prime(long long n){
	if(n==2||n==1)return 1;
	else{
		for(int i=2;i<=sqrt(n);i++){
			if(n%i==0){
				return 0;
				break;
			}
		}
	}
	return 1;
}

int main(){
	int k;
	long long n;
	k=0;
	while(scanf("%lld",&n)!=EOF){
		k++;
		if(prime(n))printf("Case #%d:I'm richer than any one\n",k);
		else printf("Case #%d:What a fxcking day\n",k);
	}
}

Double click to view unformatted code.


Back to problem 119