QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#465092 | #8046. Rock-Paper-Scissors Pyramid | lonlyness | WA | 14ms | 4212kb | C++23 | 1.1kb | 2024-07-06 17:19:47 | 2024-07-06 17:19:48 |
Judging History
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'