結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
capythm
|
| 提出日時 | 2015-11-13 22:59:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 1,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 470 ms |
| コンパイル使用メモリ | 55,440 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 15:01:57 |
| 合計ジャッジ時間 | 1,810 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <iostream>
using namespace std;
typedef long long ll;
int main( void )
{
ll x;
cin >> x;
ll ret = 1;
int cnt = 0;
while( x % 2 == 0 ){
cnt++; x /= 2;
}
if( cnt % 2 ) ret *= 2;
for( ll i=3; x >= i*i; i+=2 ){
if( x % i == 0 ){
cnt = 1; x /= i;
while( x % i == 0 ){
cnt++; x /= i;
}
if( cnt % 2 ) ret *= i;
}
}
if( x > 1 ) ret *= x;
cout << ret << endl;
}
capythm