結果

問題 No.1292 パタパタ三角形
ユーザー tailstails
提出日時 2020-11-20 21:46:46
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 48,064 KB
最終ジャッジ日時 2023-09-30 19:06:21
合計ジャッジ時間 3,696 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,676 KB
testcase_01 AC 3 ms
4,572 KB
testcase_02 AC 2 ms
4,812 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,684 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 322 ms
47,948 KB
testcase_14 AC 170 ms
21,940 KB
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$a=[0,1];
$b=[1,0];
$c=[-1,0];
$x=$y=0;$z=1;
$h{0,0}=1;

for(<>=~/./g){
	$d=$$_;
	$x+=$d->[0];
	$y+=$d->[1];
	$z+=!$h{$x,$y}++;
	if($d->[0]==0){
		$d->[1]*=-1;
	}else{
		if($_ eq 'a'){
			($b,$c)=($c,$b);
			$b->[0]*=-1;
			$b->[1]*=-1;
			$c->[0]*=-1;
			$c->[1]*=-1;
		}
		if($_ eq 'b'){
			($c,$a)=($a,$c);
			$c->[0]*=-1;
			$c->[1]*=-1;
			$a->[0]*=-1;
			$a->[1]*=-1;
		}
		if($_ eq 'c'){
			($a,$b)=($b,$a);
			$a->[0]*=-1;
			$a->[1]*=-1;
			$b->[0]*=-1;
			$b->[1]*=-1;
		}
	}
}
print$z;
0