QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#465092#8046. Rock-Paper-Scissors PyramidlonlynessWA 14ms4212kbC++231.1kb2024-07-06 17:19:472024-07-06 17:19:48

Judging History

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

  • [2024-07-06 17:19:48]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:4212kb
  • [2024-07-06 17:19:47]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<cmath>
using namespace std;
#define int long long 
#define endl "\n"
const int N = 9e5+10;
int n,m,k;
typedef pair<int,int> PII;
vector<int>g[N];
char get(char a,char b){
    if(a=='S'&&b=='R')return 'R';
    else if(a=='S'&&b=='P')return 'S';
    else if(a=='P'&&b=='S')return 'S';
    else if(a=='R'&&b=='S')return 'R';
    else if(a=='S'&&b=='S')return 'S';
    else if(a=='R'&&b=='R')return 'R';
    else if(a=='P'&&b=='P')return 'P';
    else if(a=='R'&&b=='P')return 'P';
    else if(a=='P'&&b=='R')return 'P';
}
void solve()
{
    string s;
    cin>>s;
    char last=s[0];
    // cout<<last<<endl;
    for(int i= 1;i < s.size();i ++)
    {
        char tem = get(s[i],s[i-1]);
        last= get(last,tem);
        // cout<<last<<endl;
    }
    cout<<last<<endl;
}
signed  main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
   int t=1;
   cin>>t;
   while(t--)
   {
       solve();
   }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3836kb

input:

2
SPR
SPSRRP

output:

S
P

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 14ms
memory: 4212kb

input:

1
RPPSRPPRSRSRRRPPSPRPRSRRSRRPPPRSPSSRRRSPPPRRRPRRRSSRPSSRPRRPSRRRPRSRPSRPSRRSPPRPRRRSPRSSSRPRRRPPSRRRRPPSRSRRRPRPRPRPPRRSRRPSRPPSRRRSRRSRRSPSRPRPSPSSRRSPSPSRPRRRPPRSRSPSPPRRPRSRPPSSSRPSPRRPSSSPRRSRRSRRSRSPSSSSRSSPPRRRRPRRRSPSRSPRSSPRSPSPRPRRRPPRPPRPPPSRRRRSSPRRSRRRPRRRSSRRPSRPPRSPPSPPPSPSPSPPSSPRRR...

output:

P

result:

wrong answer 1st lines differ - expected: 'R', found: 'P'