結果
問題 | No.2269 eN!の整数部分の下1桁 |
ユーザー |
|
提出日時 | 2023-04-14 21:55:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 366 bytes |
コンパイル時間 | 1,964 ms |
コンパイル使用メモリ | 193,096 KB |
最終ジャッジ日時 | 2025-02-12 06:36:53 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin>>T; while(T--){ long long N; cin>>N; if(N==0){ cout<<"2\n"; continue; } long long ans=0,t=1; for(long long i=N;i>=0&&i>N-7;i--){ ans=(ans+t)%10; t=t*(i%10)%10; } cout<<ans<<'\n'; } }