結果
| 問題 |
No.1593 Perfect Distance
|
| コンテスト | |
| ユーザー |
shisidor
|
| 提出日時 | 2023-04-02 22:38:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 612 bytes |
| コンパイル時間 | 851 ms |
| コンパイル使用メモリ | 78,812 KB |
| 実行使用メモリ | 13,756 KB |
| 最終ジャッジ日時 | 2024-09-25 00:39:36 |
| 合計ジャッジ時間 | 6,775 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 9 WA * 1 TLE * 2 -- * 5 |
ソースコード
#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;
}
shisidor