QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#727363 | #8046. Rock-Paper-Scissors Pyramid | Arkhell | WA | 0ms | 3832kb | C++14 | 1.0kb | 2024-11-09 12:57:50 | 2024-11-09 12:57:52 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 10000000;
int ys[N];
inline bool check(int dq,int mb) {
if (dq == 2 && mb == 1) return 1;
if (dq == 1 && mb == 0) return 1;
if (dq == 0 && mb == 2) return 1;
return 0;
}
void solve() {
string zfc;
cin >> zfc;
for (int i = 0; i < zfc.size(); i++) {
int dq = -1;
if (zfc[i] == 'R') {
//石头
dq = 2;
} else if (zfc[i] == 'S') {
//见到
dq = 1;
} else {
//布
dq = 0;
}
ys[i] = dq;
for (int j = i - 1; j >= 0; j--) {
if (check(dq, ys[j])) {
ys[j] = dq;
} else {
break;
}
}
}
cout << ys[0] << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int _ = 1;
cin >> _;
while (_--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3832kb
input:
2 SPR SPSRRP
output:
1 0
result:
wrong answer 1st lines differ - expected: 'S', found: '1'