結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-10 10:55:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,359 bytes |
| コンパイル時間 | 385 ms |
| コンパイル使用メモリ | 56,988 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-08 01:52:46 |
| 合計ジャッジ時間 | 3,009 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 2 RE * 14 |
ソースコード
//
// main.cpp
// Q256
//
// Created by AkihiroKOBAYASHI on 7/10/15.
// Copyright (c) 2015 Akhr5884. All rights reserved.
//
#include <iostream>
#include <string.h>
int main(int argc, const char * argv[]) {
int te[3];
int count = 0;
int sum = 0;
int point = 0;
std::string aite;
char *moji;
int *already;
// char moji[1000];
// int already[1000];
while(count < 3) {
std::cin >> te[count];
sum += te[count];
count++;
}
std::cin >> aite;
moji = (char *)malloc( strlen(aite.c_str()) + 1 );
already = (int*)malloc( strlen(aite.c_str()) + 1 );
std::sprintf(moji, "%s", aite.c_str());
// win
count = 0;
while (count < sum) {
already[count] = 0;
switch(aite[count]) {
case 'G':
if(te[2] > 0) {
te[2]--;
point += 3;
already[count] = 1;
}
break;
case 'C':
if(te[0] > 0) {
te[0]--;
point += 3;
already[count] = 1;
}
break;
case 'P':
if(te[1] > 0) {
te[1]--;
point += 3;
already[count] = 1;
}
break;
}
count++;
}
// draw
count = 0;
while (count < sum) {
if(already[count] != 1) {
switch(aite[count]) {
case 'G':
if(te[0] > 0) {
te[0]--;
point += 1;
already[count] = 1;
}
break;
case 'C':
if(te[1] > 0) {
te[1]--;
point += 1;
already[count] = 1;
}
break;
case 'P':
if(te[2] > 0) {
te[2]--;
point += 1;
already[count] = 1;
}
break;
}
}
count++;
}
free(moji);
free(already);
std::cout << point << "\n";
return 0;
}