View Code of Problem 119

#include<iostream>
#include<string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include<cstring>
using namespace std;
int sh(int n)
{
	if (n == 0 )
		return 0;
	if (n == 2 || n == 1)
	{
		return 1;
	}
	for (int i = 2;i < (int)sqrt(n) + 1;i++)
	{
		if(n%i == 0)
			return 0;
	}
	return 1;
}
int main()
{
	long long n;
	int k = 1;
	while (cin >> n)
	{
		if (sh(n) == 1)
		{
			cout <<"Case #"<<k<< ": I'm richer than any one" << endl;
		}
		else
			cout << "Case #" << k << ": What a fxcking day" << endl;
		k++;
	}
}

Double click to view unformatted code.


Back to problem 119