結果
| 問題 | No.1593 Perfect Distance | 
| コンテスト | |
| ユーザー |  4zuki | 
| 提出日時 | 2021-07-09 21:30:49 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 414 bytes | 
| コンパイル時間 | 1,588 ms | 
| コンパイル使用メモリ | 171,176 KB | 
| 実行使用メモリ | 12,800 KB | 
| 最終ジャッジ日時 | 2024-07-01 15:17:45 | 
| 合計ジャッジ時間 | 2,544 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 WA * 5 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using namespace std;
using ll = long long;
int main() {
    ll n;
    cin >> n;
    set<ll> st;
    for (int i = 1; i <= n; i++) {
        st.insert(i * i);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ll tmp = n * n - i * i;
        if (st.count(tmp)) {
            ans++;
        }
    }
    cout << ans << endl;
}
            
            
            
        