QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#624127#8046. Rock-Paper-Scissors PyramidDukerkiCompile Error//C++201.8kb2024-10-09 15:01:322024-10-09 15:01:33

Judging History

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

  • [2024-10-09 15:01:33]
  • 评测
  • [2024-10-09 15:01:32]
  • 提交

answer

#include <iostream>
#include <list>
using namespace std;
int cnt = 0,total = 0;
void EachT()
{
    cnt++;
    string str;
    int n;
    cin >> str;
    if(cnt == 471 && total = 130000){
        cout << str << endl;
    }
    string s;
    char T;
    s = str;
    str.clear();
    for (int i = 1; i < s.size(); i++)
    {
        if ((s[i - 1] == 'S' && s[i] == 'P') || (s[i - 1] == 'P' && s[i] == 'R') || (s[i - 1] == 'R' && s[i] == 'S'))
        {
            str.push_back(s[i - 1]);
        }
        else
        {
            str.push_back(s[i]);
        }
    }
    s.clear();
    while (s.size() != 1)
    {
        s.clear();
        bool flag = true;
        for (int i = 0; i < str.size(); i++)
        {
            T = str[i];
            if (s.size() == 0 || s.back() != T)
            {
                s.push_back(T);
            }
            else
            {
                flag = false;
            }
        }
        if (flag)
        {
            break;
        }
        str.clear();
        for (int i = 1; i < s.size(); i++)
        {
            if ((s[i - 1] == 'S' && s[i] == 'P') || (s[i - 1] == 'P' && s[i] == 'R') || (s[i - 1] == 'R' && s[i] == 'S'))
            {
                str.push_back(s[i - 1]);
            }
            else
            {
                str.push_back(s[i]);
            }
        }
    }
    if (s.size() == 1)
    {
        cout << s[0] << endl;
    }
    else
    {
        if ((s[0] == 'S' && s[1] == 'P') || (s[0] == 'P' && s[1] == 'R') || (s[0] == 'R' && s[1] == 'S'))
        {
            cout << s[0] << endl;
        }
        else
        {
            cout << s[s.size() - 1] << endl;
        }
    }
}
int main()
{
    int t;
    cin >> t;
    total = t;
    while (t--)
    {
        EachT();
    }
}

Details

answer.code: In function ‘void EachT()’:
answer.code:11:19: error: lvalue required as left operand of assignment
   11 |     if(cnt == 471 && total = 130000){
      |        ~~~~~~~~~~~^~~~~~~~