結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2017-04-08 00:39:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 1,975 ms |
コンパイル使用メモリ | 161,700 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-16 03:34:39 |
合計ジャッジ時間 | 2,096 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 16 WA * 4 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long int StringToInt(string str){ stringstream ss; ss << str; int num; ss >> num; return num; } int check(int n, int a){ string str = to_string(n * a); if(str.length() > 12){ str = str.substr(str.length() - 12, 12); } return StringToInt(str); } signed main(){ int n; cin >> n; int ans = 1; if(n >= 50){ cout << "000000000000" << endl; }else{ bool ok = false; for(int i = 1; i <= n; i++){ ans = check(ans, i); } printf("%012lld\n", ans); } }