結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, z;
  cin >> n >> z;
  if (n == 1) {
    puts(z == 1 ? "No" : "Yes");
  } else if (n == 2) {
    for (int x = 1; x <= z; x++) {
      for (int y = 1; y <= z; y++) {
        if (x * x + y * y == z * z) {
          puts("Yes");
          return 0;
        }
      }
    }
    puts("No");
  } else {
    puts("No");
  }
  return 0;
}
0