結果

問題 No.2785 四乗足す四の末尾の0
ユーザー eve__fuyuki
提出日時 2024-06-14 21:58:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 583 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 192,508 KB
最終ジャッジ日時 2025-02-21 21:59:19
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

void solve() {
    long long n;
    cin >> n;
    if (n < 0) {
        n = -n;
    }
    if (n == 1) {
        cout << "Yes\n";
        cout << "0\n";
        return;
    }
    cout << "No\n";
    n %= 100;
    long long num = n * n * n * n + 4;
    int ans = 0;
    while (num % 10 == 0) {
        num /= 10;
        ans++;
    }
    cout << ans << "\n";
}
int main() {
    fast_io();
    int t;
    cin >> t;
    for (; t--;) {
        solve();
    }
}
0