結果

問題 No.1218 Something Like a Theorem
ユーザー yuui
提出日時 2020-09-04 21:29:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 192,548 KB
最終ジャッジ日時 2025-01-14 05:06:48
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main() {
    ll n, z;
    cin >> n >> z;
    if (n >= 3 || z == 1) {
        cout << "No" << endl;
        return 0;
    }
    if (n == 1) {
        cout << "Yes" << endl;
        return 0;
    }

    for (int x = 1; x <= 1000; x++)
        for (int y = 1; y <= 1000; y++) {
            if (x * x + y * y == z * z) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    cout << "No" << endl;

    return 0;
}
0