View Code of Problem 119

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<climits>
#include<cmath>
#include<map>
#include<set>

using namespace std;

bool judge(int num) {

	if (num == 1)
		return true;

	for (int i = 2; i <= sqrt(num); i++) {

		if (num % i == 0)
			return false;
	}

	return true;
}

int main()
{
	int n;
	int num = 1;
	while (cin >> n) {

		if (judge(n))
			cout << "Case #" << num << ": " << "I'm richer than any one" << endl;
		else
			cout << "Case #" << num << ": " << "What a fxcking day" << endl;

		num++;
	}
}

Double click to view unformatted code.


Back to problem 119