結果

問題 No.2785 四乗足す四の末尾の0
ユーザー VvyLw
提出日時 2024-06-14 23:50:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 6,337 ms
コンパイル使用メモリ 337,148 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-14 23:51:00
合計ジャッジ時間 7,496 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>
inline void solve() {
    int n, cnt = 0;
    std::cin >> n;
    std::cout << (std::abs(n) == 1 ? "Yes\n" : "No\n");
    auto m = boost::multiprecision::cpp_int(n) * n * n * n + 4;
    while(m % 10 == 0) {
        m /= 10;
        cnt++;
    }
    std::cout << cnt << '\n';
}
int main() {
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    int t;
    std::cin >> t;
    while(t--) {
        solve();
    }
}
0