結果

問題 No.1218 Something Like a Theorem
ユーザー ぷら
提出日時 2021-03-16 00:42:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 167,828 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 13:12:24
合計ジャッジ時間 2,825 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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 = false;
        for(int x = 1; x <= 1000; x++) {
            for(int y = 1; y <= 1000; y++) {
                if(x*x+y*y == z*z) {
                    flag = true;
                }
            }
        }
        if(flag) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}
0