結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-11-13 23:10:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 401 bytes |
| コンパイル時間 | 562 ms |
| コンパイル使用メモリ | 47,860 KB |
| 実行使用メモリ | 13,760 KB |
| 最終ジャッジ日時 | 2024-09-13 15:06:54 |
| 合計ジャッジ時間 | 3,282 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 4 WA * 13 TLE * 1 -- * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | long long x,ans;scanf("%lld",&x);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
//namaega184
int main(){
long long x,ans;scanf("%lld",&x);
vector<int> a(1000001);
a[1]=1;
for(int i=2;x!=1;i++){
if(x%i)continue;
while(x%i==0){
a[i]++;
x/=i;
}
}
ans=1;
for(long long i=2;i*i<=x;i++){
if(a[i]&&a[i]%2)ans*=i;
}
printf("%lld\n",ans);
return 0;
}
184