結果

問題 No.385 カップ麺生活
ユーザー %20
提出日時 2018-05-22 16:57:29
言語 Perl
(5.40.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 22:57:40
合計ジャッジ時間 1,601 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::N" used only once: possible typo at Main.pl line 2.
Main.pl syntax OK

ソースコード

diff #

$M=<>;
$N=<>;
@C=glob<>;
for$i(reverse 1..$M){
	if($i==$M||$d[$i]){
		for$c(@C){
			$j=$i-$c;
			if($j>=0){
				$d[$j]+=$-=$d[$i]+1-$d[$j]
			}
		}
	}
}
for$i(2..sqrt$M){
	if(!$p[$i]){
		for($j=$i;($j+=$i)<=$M;){
			$p[$j]=1
		}
	}
}
for(2..$M){
	$x+=$p[$_]?0:$d[$_]
}
print$x+$M/(sort{$a-$b}@C)[0]|0
0