結果
問題 | No.2269 eN!の整数部分の下1桁 |
ユーザー | Nzt3 |
提出日時 | 2023-04-14 21:55:07 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 366 bytes |
コンパイル時間 | 1,984 ms |
コンパイル使用メモリ | 199,272 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 12:40:45 |
合計ジャッジ時間 | 3,046 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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'; } }