結果

問題 No.2269 eN!の整数部分の下1桁
ユーザー momoyuu
提出日時 2023-04-15 10:20:42
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 2,782 ms
コンパイル使用メモリ 243,720 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 22:45:05
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        if(n==0) n = 1;
        int ans = 0;
        int now = n % 10;
        n--;
        while(now!=0){
            ans += now;
            ans %= 10;
            int nxt = n % 10;
            now *= nxt;
            n--;
        }
        ans++;
        ans%=10;
        cout<<ans<<endl;
    }
}

0