結果

問題 No.1593 Perfect Distance
ユーザー kuhaku
提出日時 2021-07-10 00:17:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 282 bytes
コンパイル時間 1,992 ms
コンパイル使用メモリ 196,804 KB
最終ジャッジ日時 2025-01-22 23:09:20
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void) {
    int n;
    cin>>n;
    set<int> st;
    for (int i = 1; i <= n; ++i) st.insert(i*i);
    int ans = 0;
    for (int i = 0; i <= n; ++i) {
        ans += st.find(n*n-i*i) != st.end();
    }
    cout << ans << endl;
}
0