結果
問題 | No.500 階乗電卓 |
ユーザー |
|
提出日時 | 2020-04-05 15:26:24 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 12,711 ms |
コンパイル使用メモリ | 378,296 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 08:12:39 |
合計ジャッジ時間 | 13,345 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: u64 = itr.next().unwrap().parse().unwrap(); let mut ans = 1; let mut koeta = false; if n < 50 { for i in 1..n + 1 { ans *= i; if ans >= 1000000000000 { koeta = true; ans %= 1000000000000; } } } else { ans = 0; } if koeta || ans == 0 { println!("{:<012}", ans); } else { println!("{}", ans); } }