結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-28 17:39:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 440 bytes |
| コンパイル時間 | 668 ms |
| コンパイル使用メモリ | 55,856 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-11-24 05:14:02 |
| 合計ジャッジ時間 | 33,945 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 10 WA * 17 TLE * 16 |
ソースコード
#include <iostream>
#include <cstdint>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int64_t n;
cin >> n;
if (n == 1) {
cout << "1" << endl;
return 0;
}
int ans = 1;
int count = 0;
for (int i = 2; i * i <= n; i++) {
while (n % i == 0) {
n /= i;
count++;
}
if (count & 1) {
ans *= i;
}
}
if (n > 1) {
ans *= n;
}
cout << ans << endl;
}