結果
| 問題 | No.300 平方数 |
| コンテスト | |
| ユーザー |
data9824
|
| 提出日時 | 2015-12-25 02:29:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 1,000 ms |
| コード長 | 533 bytes |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 70,264 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-18 23:42:08 |
| 合計ジャッジ時間 | 2,040 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <iostream>
#include <map>
#include <cmath>
using namespace std;
int main() {
long long x;
cin >> x;
map<long long, long long> factors;
for (long long divisor = 2; divisor * divisor <= x; ++divisor) {
while (x % divisor == 0) {
x /= divisor;
++factors[divisor];
}
}
if (x > 1) {
++factors[x];
}
long long y = 1;
for (map<long long, long long>::const_iterator it = factors.begin();
it != factors.end();
++it) {
if (it->second % 2 != 0) {
y *= it->first;
}
}
cout << y << endl;
return 0;
}
data9824