結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, z; cin >> n >> z;
	if (n > 2) cout << "No" << endl;
	else if (n == 1) {
		if (z == 1) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	else {
		bool ok = false;
		for (int x = 1; x < z; ++x) {
			for (int y = x; y < z; ++y) {
				if (x*x + y*y == z*z) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
		cout << "No" << endl;
	}
	return 0;
}
0