View Code of Problem 119

#include <iostream>
#include <valarray>

using namespace std;

/**
 * kkmd66
 * @return
 */

int main() {

    int n, count = 0;
    while (cin >> n) {

        count++;

        bool flag = true;

        if (n == 1)
            cout << "Case #" << count << ": I'm richer than any one" << endl;
        else {
            for (int j = 2; j <= sqrt(n); ++j) {
                if (n % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag)
                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