結果

問題 No.1218 Something Like a Theorem
ユーザー _umbrella_kasa
提出日時 2021-07-02 23:18:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 165,848 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-29 13:05:42
合計ジャッジ時間 1,950 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
                }
            }
        }
        if (flag) {
            cout << "No" << endl;
        }
    }
}
    
0