結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
kahuu
|
| 提出日時 | 2016-03-13 01:48:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 1,000 ms |
| コード長 | 374 bytes |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 22,912 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 11:14:11 |
| 合計ジャッジ時間 | 1,469 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%lld", &x);x2=x;
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
int main(void) {
long long int x, x2;
scanf("%lld", &x);x2=x;
long long int i = 2;
long long int j = 0;
long long int answer = 1;
while (x2 >= i * i) {
if (x % i == 0) {
x /= i;
j++;
} else {
if (j % 2 == 1) answer *= i;
j = 0;
i++;
}
}
answer *= x;
printf("%lld\n", answer);
return 0;
}
kahuu