結果

問題 No.2269 eN!の整数部分の下1桁
ユーザー hiro71687khiro71687k
提出日時 2023-04-15 00:40:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 855 bytes
コンパイル時間 4,797 ms
コンパイル使用メモリ 254,684 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-18 22:01:47
合計ジャッジ時間 8,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=144494;
ll mod=1000000007;
int main(){
    ll t;
    cin >> t;
    vector<ll>ans;
    for (ll o = 0; o < t; o++)
    {
        ll n;
        cin >> n;
        if (n==1)
        {
            ans.push_back(2);
            continue;
        }
        
        ll x=1;
        for (ll i = 1; i <=n; i++)
        {
            x*=i;
            x%=10;
        }
        ll a=x*2;
        a%=10;
        ll y=1;
        a+=1;
        a%=10;
        for (ll i = n; i >2; i--)
        {
            y*=i;
            y%=10;
            a+=y;
            a%=10;
        }
        ans.push_back(a);
    }
    for (ll i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << endl;
    }
    
}
0