QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#727363#8046. Rock-Paper-Scissors PyramidArkhellWA 0ms3832kbC++141.0kb2024-11-09 12:57:502024-11-09 12:57:52

Judging History

你现在查看的是最新测评结果

  • [2024-11-09 12:57:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-11-09 12:57:50]
  • 提交

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();
    }
}

详细

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'