結果

問題 No.623 fudan no modulus to tigau
ユーザー tailstails
提出日時 2017-12-23 00:07:38
言語 Perl
(5.38.2)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 5,276 KB
最終ジャッジ日時 2023-08-22 21:33:13
合計ジャッジ時間 1,328 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,120 KB
testcase_01 AC 7 ms
5,216 KB
testcase_02 AC 7 ms
5,276 KB
testcase_03 AC 7 ms
5,220 KB
testcase_04 AC 7 ms
5,180 KB
testcase_05 AC 7 ms
5,236 KB
testcase_06 AC 7 ms
5,236 KB
testcase_07 AC 7 ms
5,212 KB
testcase_08 AC 8 ms
5,236 KB
testcase_09 AC 7 ms
5,180 KB
testcase_10 AC 7 ms
5,136 KB
testcase_11 AC 7 ms
5,240 KB
testcase_12 AC 6 ms
5,068 KB
testcase_13 AC 7 ms
5,120 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::q" used only once: possible typo at Main.pl line 4.
Main.pl syntax OK

ソースコード

diff #

$m=998244353;
$n=<>;
($t[$_],$a[$_],$b[$_])=glob<> for 2..$n;
$q=<>;
@x=glob<>;
for$x(@x){
	$f[0]=1;
	$f[1]=$x;
	for$i(2..$n){
		$f[$i]=
			$t[$i]==1?($f[$a[$i]]+$f[$b[$i]])%$m:
			$t[$i]==2?($a[$i]*$f[$b[$i]])%$m:
			$t[$i]==3?($f[$a[$i]]*$f[$b[$i]])%$m:
			0;
	}
	print$f[$n],$/;
}
0