結果
問題 | No.1593 Perfect Distance |
ユーザー |
![]() |
提出日時 | 2021-07-09 22:48:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 101 ms / 2,000 ms |
コード長 | 730 bytes |
コンパイル時間 | 939 ms |
コンパイル使用メモリ | 89,632 KB |
実行使用メモリ | 16,000 KB |
最終ジャッジ日時 | 2024-07-01 17:58:22 |
合計ジャッジ時間 | 1,886 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <functional> #include <cmath> #include <map> #include <queue> #include <string> #include <string.h> #define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++) #define rep(i,n) reps(i,0,n) using namespace std; using ll = long long; using pii = pair<int,int>; using vi = vector<int> ; using vl = vector<ll>; int main(){ ll n; cin >> n; n = n * n; map<ll,ll> mp; for(ll x = 1; x*x <= n; x++){ mp[x*x]++; //cout << x << ":" << x*x << endl; } //cout << mp.size() << endl; int ans = 0; for(auto e: mp){ if(mp.count(n-e.first)==1){ ans++; } } cout << ans << endl; return 0; }