結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2019-02-26 06:06:43 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 387 bytes |
コンパイル時間 | 16,954 ms |
コンパイル使用メモリ | 239,912 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 00:33:12 |
合計ジャッジ時間 | 15,507 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 2 |
ソースコード
package main import ( "fmt" "strconv" ) var mod int func fact(n int) int { if n == 0 { return 1 } return (n * fact(n-1)) % mod } func main() { mod = pow(10, 12) var n int fmt.Scan(&n) if n >= 50 { fmt.Println(strconv.Itoa(mod)[1:]) } else { fmt.Println(fact(n)) } } func pow(a, b int) int { res := 1 for range make([]struct{}, b) { res *= a } return res }