結果

問題 No.1593 Perfect Distance
ユーザー kkkk97368086kkkk97368086
提出日時 2021-12-06 09:26:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 72,216 KB
実行使用メモリ 12,712 KB
最終ジャッジ日時 2023-09-21 15:05:31
合計ジャッジ時間 2,003 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 10 ms
4,636 KB
testcase_11 AC 16 ms
5,496 KB
testcase_12 AC 30 ms
6,872 KB
testcase_13 AC 33 ms
7,432 KB
testcase_14 AC 38 ms
7,740 KB
testcase_15 AC 59 ms
9,900 KB
testcase_16 AC 88 ms
12,712 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;
int main(){
    set<long long> x;
    long long n;cin>>n;
    for(long long i = 1; n > i; i++){
        x.insert(i*i);
    }
    int a = 0;
    for(long long i = 1; n > i; i++){
        if(x.find(n*n-i*i) != x.end())a++;
    }
    cout << a << endl;
}
0