結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2016-12-13 00:50:25 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 51 ms |
コンパイル使用メモリ | 5,888 KB |
実行使用メモリ | 6,016 KB |
最終ジャッジ日時 | 2024-11-29 23:39:04 |
合計ジャッジ時間 | 2,629 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 84 |
コンパイルメッセージ
Name "main::k" used only once: possible typo at Main.pl line 1. Name "main::db" used only once: possible typo at Main.pl line 4. Main.pl syntax OK
ソースコード
($n,$k)=glob<>; $r=1; for(sort{$a<=>$b}<>=~/\d+/g){ die if $db++==0 && $b!=0; $a="$_"|0; if($b&~$a){ #die; print 0; exit; } for(1..c($a)- c($b)){ $r=($r*$_)%(1e9+7); } $b=$a; } { for(1..$n- c($b)){ $r=($r*$_)%(1e9+7); } } print $r; sub c { my $v=0; my ($n)=@_; while($n){ $v+=$n&1; $n>>=1; } $v }