結果
問題 |
No.2392 二平方和
|
ユーザー |
|
提出日時 | 2023-08-01 20:51:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 1,834 ms |
コンパイル使用メモリ | 196,728 KB |
最終ジャッジ日時 | 2025-02-15 21:23:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define int long long set<int> s; void anubhav(){ int n; cin >> n; for(int i = 1; i * i <= n; i++) { int x = i * i; int y = n - x; if(s.find(y) != s.end()) { cout << "Yes\n"; return; } } cout << "No\n"; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for(int i = 1; i * i <= 1e8; i++) { s.insert(i * i); } int T = 1; // cin >> T; while(T--) anubhav(); return 0; }