結果
| 問題 | No.2785 四乗足す四の末尾の0 |
| コンテスト | |
| ユーザー |
Tatsu_mr
|
| 提出日時 | 2024-06-14 23:09:04 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 161 ms / 2,000 ms |
| コード長 | 601 bytes |
| 記録 | |
| コンパイル時間 | 1,016 ms |
| コンパイル使用メモリ | 214,464 KB |
| 実行使用メモリ | 9,272 KB |
| 最終ジャッジ日時 | 2026-07-05 00:23:12 |
| 合計ジャッジ時間 | 2,930 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
auto cnt = [](long long x, long long d) -> long long {
long long res = 0;
while (x % d == 0) {
res++;
x /= d;
}
return res;
};
while (t--) {
long long n;
cin >> n;
cout << (abs(n) == 1 ? "Yes" : "No") << endl;
long long x = n * n + 2LL * n + 2LL, y = n * n - 2LL * n + 2LL;
long long two = cnt(x, 2LL) + cnt(y, 2LL), five = cnt(x, 5LL) + cnt(y, 5LL);
cout << min(two, five) << endl;
}
}
Tatsu_mr