結果
| 問題 | 
                            No.2269 eN!の整数部分の下1桁
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-04-14 22:03:47 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 415 bytes | 
| コンパイル時間 | 1,822 ms | 
| コンパイル使用メモリ | 193,152 KB | 
| 最終ジャッジ日時 | 2025-02-12 06:43:24 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 TLE * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int solve(ll n){
    if(n <= 1) return 2;
    int d = 0;
    ll aux = 1;
    for(ll i = n;i >= n - 5 && i >= 0;--i){
        d = (d + aux) % 10;
        aux = aux * n % 10;
        --n;
    }
    return d;
}
int main(){
    int T;
    cin >> T;
    ll N;
    while(T--){
        cin >> N;
        cout << solve(N) << '\n';
    }
    return 0;
}