結果

問題 No.1593 Perfect Distance
ユーザー kuhaku
提出日時 2021-07-10 00:16:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 4,328 ms
コンパイル使用メモリ 196,196 KB
最終ジャッジ日時 2025-01-22 23:08:57
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.count(n*n-i*i);
    }
    cout << ans << endl;
}
0