結果

問題 No.1218 Something Like a Theorem
ユーザー _umbrella_kasa
提出日時 2021-07-02 23:19:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 2,606 ms
コンパイル使用メモリ 166,020 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-29 13:06:49
合計ジャッジ時間 2,139 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 12 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,z;
    cin >> n >> z;
    if (n>=3) {
        cout << "No" << endl;
    }
    else if (n==1) {
        if (z==1) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
    else {
        bool flag=true;
        for (int i=1; i<=z; i++) {
            for (int j=1; j<=z; j++) {
                if (i*i+j*j==z*z) {
                    flag=false;
                    cout << "Yes" << endl;
                    break;
                }
            }
        }
        if (flag) {
            cout << "No" << endl;
        }
    }
}
0