結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2018-03-15 22:47:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 594 bytes |
コンパイル時間 | 814 ms |
コンパイル使用メモリ | 70,144 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 13:52:46 |
合計ジャッジ時間 | 1,735 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 16 WA * 4 |
ソースコード
// No.500 階乗電卓 // https://yukicoder.me/problems/no/500 // #include <iostream> #include <string> #include <iomanip> using namespace std; string solve(long long int N); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); long long N; cin >> N; string ans = solve(N); cout << setw(12) << setfill('0') << ans << endl; } string solve(long long int N) { if (N >= 50) return "000000000000"; long long ans = 1; for (auto i = 2; i <= N; ++i) { ans *= i; ans %= 1000000000000; } return to_string(ans); }