結果
問題 | No.1218 Something Like a Theorem |
ユーザー |
|
提出日時 | 2020-09-04 21:27:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 1,458 ms |
コンパイル使用メモリ | 165,812 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 11:52:12 |
合計ジャッジ時間 | 2,063 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;constexpr char newl = '\n';int main() {cin.tie(nullptr);ios::sync_with_stdio(false);int n;ll z;cin >> n >> z;if (n >= 3) {cout << "No\n";} else if (n == 1) {cout << (z == 1 ? "No" : "Yes") << newl;} else {ll z2 = z * z;for (ll x = 1; x <= z; x++) {for (ll y = 1; y <= z; y++) {if (x * x + y * y == z2) {cout << "Yes\n";return 0;}}}cout << "No" << newl;}return 0;}