結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2018-05-23 00:03:50 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 334 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2024-06-28 15:55:56 |
合計ジャッジ時間 | 983 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/env perluse strict;use warnings;my $n = <>; chomp $n;my %h;$h{1} = 1;for (my $i = 2; $i < 50; $i++) {$h{$i} = ($h{$i - 1} * $i) % 1000000000000;}if ($n >= 50) {print "000000000000\n";} else {if (length $h{$n - 1} > length $h{$n}) {printf "%012d\n", $h{$n};} else {printf "$h{$n}\n";}}