結果

問題 No.1593 Perfect Distance
ユーザー suminoeno7suminoeno7
提出日時 2023-04-02 22:38:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 77,848 KB
実行使用メモリ 8,696 KB
最終ジャッジ日時 2023-10-25 05:13:42
合計ジャッジ時間 7,253 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,744 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 232 ms
4,348 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;

int main() {
    int n;
    cin >> n;
    long long res = 0;
    for (int x = 1; x < n; x++) {
        long long y2 = (long long)n * n - x * x;
        map<int, int> y;
        for (int i = 2; i < n; i++) {
            while(y2 % i == 0) {
                y2 /= i;
                y[i]++;
            }
            if (y2 == 1) break;
            if (i == n - 1) y[y2]++;
        }
        bool b = true;
        for (auto p : y) {
            if (p.second % 2 == 1) b = false;
        }
        if (b) res++;
    }
    cout  << res << endl;
    return 0;
}
0