結果
| 問題 |
No.1218 Something Like a Theorem
|
| コンテスト | |
| ユーザー |
钟梓皓
|
| 提出日時 | 2020-09-04 21:26:01 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 465 bytes |
| コンパイル時間 | 1,992 ms |
| コンパイル使用メモリ | 192,136 KB |
| 最終ジャッジ日時 | 2025-01-14 04:58:49 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d%d", &n, &z);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
int main(){
int n, z;
scanf("%d%d", &n, &z);
if (n >= 3){
puts("No");
return 0;
}
if (n == 1){
puts(z >= 2 ? "Yes" : "No");
return 0;
}
z *= z;
for (int i = 1; i * i <= z; ++ i){
for (int j = 1; j * j <= z; ++ j){
if (i * i + j * j == z){
puts("Yes");
return 0;
}
}
}
puts("No");
return 0;
}
钟梓皓