結果

問題 No.2269 eN!の整数部分の下1桁
ユーザー ruthen71
提出日時 2023-04-14 23:13:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 1,810 ms
コンパイル使用メモリ 191,788 KB
最終ジャッジ日時 2025-02-12 07:59:25
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 3 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif

#define REP(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt;
    cin >> tt;
    while (tt--) {
        long long N;
        cin >> N;
        long long ans = 0, c = 1;
        for (long long k = N; k >= 1; k--) {
            ans += c;
            ans %= 10;
            c = c * k % 10;
        }
        ans += c;
        ans %= 10;
        cout << ans << '\n';
    }
    return 0;
}
0