結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
togaerror
|
| 提出日時 | 2015-06-29 16:51:03 |
| 言語 | Perl (5.40.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 565 bytes |
| コンパイル時間 | 464 ms |
| コンパイル使用メモリ | 5,632 KB |
| 実行使用メモリ | 5,760 KB |
| 最終ジャッジ日時 | 2024-07-07 21:11:20 |
| 合計ジャッジ時間 | 1,283 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 9 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
use strict;
use warnings;
my ($g, $c, $p) = split / /, <>;
my $s = <>;
chomp $s;
my @sa = split //, $s;
my $total = 0;
for(my $i = 0; $i < $#sa + 1; $i++) {
if($sa[$i] eq 'G') {
if($p > 0) {
$total += 3;
$p--;
} elsif($g > 0) {
$total++;
$g--;
} else {
$c--;
}
} elsif($sa[$i] eq 'C') {
if($g > 0) {
$total += 3;
$g--;
} elsif($c > 0) {
$total++;
$c--;
} else {
$p--;
}
} else {
if($c > 0) {
$total += 3;
$c--;
} elsif($p > 0) {
$total++;
$p--;
} else {
$g--;
}
}
}
print "$total\n";
exit;
togaerror