結果
| 問題 |
No.2392 二平方和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-26 19:18:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 332 bytes |
| コンパイル時間 | 2,125 ms |
| コンパイル使用メモリ | 197,576 KB |
| 最終ジャッジ日時 | 2025-02-25 06:19:50 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int P;
cin >> P;
set<int> st;
for (int i = 0; i * i <= 1e9; i++){
st.insert(i * i);
}
bool ok = false;
for (int i = 0; i * i <= 1e9; i++){
if (st.count(P - i * i) > 0){
ok = true;
}
}
if (ok){
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}