結果
問題 | No.2785 四乗足す四の末尾の0 |
ユーザー |
![]() |
提出日時 | 2024-06-14 23:09:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 309 ms / 2,000 ms |
コード長 | 601 bytes |
コンパイル時間 | 2,090 ms |
コンパイル使用メモリ | 194,108 KB |
最終ジャッジ日時 | 2025-02-21 22:23:36 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; } }