QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624201 | #8046. Rock-Paper-Scissors Pyramid | REN5511 | WA | 18ms | 5260kb | C++14 | 1.2kb | 2024-10-09 15:13:46 | 2024-10-09 15:13:47 |
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) {
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: 3704kb
input:
2 SPR SPSRRP
output:
S P
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 18ms
memory: 5260kb
input:
1 RPPSRPPRSRSRRRPPSPRPRSRRSRRPPPRSPSSRRRSPPPRRRPRRRSSRPSSRPRRPSRRRPRSRPSRPSRRSPPRPRRRSPRSSSRPRRRPPSRRRRPPSRSRRRPRPRPRPPRRSRRPSRPPSRRRSRRSRRSPSRPRPSPSSRRSPSPSRPRRRPPRSRSPSPPRRPRSRPPSSSRPSPRRPSSSPRRSRRSRRSRSPSSSSRSSPPRRRRPRRRSPSRSPRSSPRSPSPRPRRRPPRPPRPPPSRRRRSSPRRSRRRPRRRSSRRPSRPPRSPPSPPPSPSPSPPSSPRRR...
output:
P
result:
wrong answer 1st lines differ - expected: 'R', found: 'P'