結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
|
提出日時 | 2015-07-10 08:30:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,813 bytes |
コンパイル時間 | 357 ms |
コンパイル使用メモリ | 56,060 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 01:52:04 |
合計ジャッジ時間 | 934 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 9 |
ソースコード
// // 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; while(count < 3) { std::cin >> te[count]; sum += te[count]; count++; } std::cin >> aite; moji = (char *)malloc( strlen(aite.c_str()) + 1 ); std::sprintf(moji, "%s", aite.c_str()); count = 0; while (count < sum) { switch(moji[count]) { case 'G' : if(te[2] > 0) { point += 3; te[2]--; } else if(te[0] > 0) { point += 1; te[0]--; } else { te[1]--; } break; case 'C' : if(te[0] > 0) { point += 3; te[0]--; } else if(te[1] > 0) { point += 1; te[1]--; } else { te[2]--; } break; case 'P' : if(te[1] > 0) { point += 3; te[1]--; } else if(te[2] > 0) { point += 1; te[2]--; } else { te[0]--; } break; default: break; } count++; } std::cout << point << "\n"; return 0; }