結果

問題 No.297 カードの数式
ユーザー %20
提出日時 2021-04-02 23:40:30
言語 Perl
(5.40.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 293 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,632 KB
最終ジャッジ日時 2024-12-23 22:40:58
合計ジャッジ時間 1,418 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::j" used only once: possible typo at Main.pl line 14.
Name "main::i" used only once: possible typo at Main.pl line 5.
Main.pl syntax OK

ソースコード

diff #

<>;
$_=<>;
@d=sort/\d/g;
@D=sort{1}sort/[-+]/g;
print eval reverse join'',map$_.$D[$i++],@d;
print$";
if(/-/){
	@D=sort{1}@D;
	pop@D;
	$e.=(shift@d).$_ for@D;
	$e.=shift@d;
	print eval"$e-".join'',sort{1}@d
}else{
	$_[$j++%(@D+1)]=~s/^/$_/ for sort{1}@d;
	print eval join('+',@_)=~s/0\B//gr
}
0