結果
| 問題 | No.300 平方数 |
| コンテスト | |
| ユーザー |
保登心愛
|
| 提出日時 | 2015-11-13 23:13:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 800 bytes |
| コンパイル時間 | 579 ms |
| コンパイル使用メモリ | 64,360 KB |
| 実行使用メモリ | 13,888 KB |
| 最終ジャッジ日時 | 2024-09-13 15:09:17 |
| 合計ジャッジ時間 | 3,579 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 10 TLE * 1 -- * 22 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
int isPrime(int x)
{
if (x == 2) return 1;
if (x < 2 || x % 2 == 0) return 0;
for (int i = 3; i * i <= x; i++) {
if (x % i == 0) {
return 0;
}
}
return 1;
}
int main() {
ll x, y = 1;
cin >> x;
for (int i = 2; i * i <= x; i++) {
if (isPrime(i)) {
int cnt = 0;
while (x % i == 0) {
x /= i;
cnt++;
}
if (cnt > 0 && cnt % 2 == 1) y *= i;
}
}
cout << y << endl;
return 0;
}
保登心愛