QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624234 | #8046. Rock-Paper-Scissors Pyramid | REN5511 | WA | 19ms | 5220kb | C++14 | 1.2kb | 2024-10-09 15:17:58 | 2024-10-09 15:17:59 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
string tar;
char win(char p1, char p2) {
if (p1 == 'S') {
if (p2 == 'S') {
return 'S';
}
else if (p2 == 'P') {
return 'S';
}
else {
return 'R';
}
}
else if (p1 == 'P') {
if (p2 == 'S') {
return 'S';
}
else if (p2 == 'P') {
return 'P';
}
else {
return 'P';
}
}
else {
if (p2 == 'S') {
return 'R';
}
else if (p2 == 'P') {
return 'P';
}
else {
return 'R';
}
}
return '$';
}
int main()
{
int t;
cin >> t;
while (t--) {
cin >> tar;
char who,atk;
who = tar[0], atk = tar[0];
for (auto i : tar) {
if (win(i, atk) == who) {
who = win(i, atk);
atk = i;
}
else if (win(i, atk) == i&&i!=atk) {
atk = i; who = i;
}
}
cout << who << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
2 SPR SPSRRP
output:
S P
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 19ms
memory: 5220kb
input:
1 RPPSRPPRSRSRRRPPSPRPRSRRSRRPPPRSPSSRRRSPPPRRRPRRRSSRPSSRPRRPSRRRPRSRPSRPSRRSPPRPRRRSPRSSSRPRRRPPSRRRRPPSRSRRRPRPRPRPPRRSRRPSRPPSRRRSRRSRRSPSRPRPSPSSRRSPSPSRPRRRPPRSRSPSPPRRPRSRPPSSSRPSPRRPSSSPRRSRRSRRSRSPSSSSRSSPPRRRRPRRRSPSRSPRSSPRSPSPRPRRRPPRPPRPPPSRRRRSSPRRSRRRPRRRSSRRPSRPPRSPPSPPPSPSPSPPSSPRRR...
output:
P
result:
wrong answer 1st lines differ - expected: 'R', found: 'P'