QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555470#8046. Rock-Paper-Scissors Pyramidcode_side-effectCompile Error//C++20885b2024-09-09 23:37:382024-09-09 23:37:38

Judging History

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

  • [2024-09-09 23:37:38]
  • 评测
  • [2024-09-09 23:37:38]
  • 提交

answer

\#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
const int N = 1e6 + 6;
int a[N];

int cmp(char a , char b){
    if(a == b) return 0 ;
    if(a == 'S' &&  b == 'P') return 1;
    else if(a == 'P' &&  b == 'R') return 1;
    else if(a == 'R' &&  b == 'S') return 1;
    else return -1 ; 
}

void solve(){
    string s;
    cin >> s;
    i64 n = s.size();
    s = ' ' + s ;
    for(int i = 1 ; i <= n ; i++){
        if(cmp(s[i] , s[i-1]) == 1) a[i] = a[i-1] - 1;
        else if(cmp(s[i] , s[i-1]) == -1) a[i] = a[i-1] + 1 ;
        else a[i] = a[i-1];
    }
    int min = 1e9,id = -1;
    for(int i = 1 ;i<=n;i++){
        if(min > a[i]){
            min = a[i];
            id = i;
        }
    }
    cout << s[id] << "\n";
}

int main(){
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Details

answer.code:1:1: error: stray ‘\’ in program
    1 | \#include<bits/stdc++.h>
      | ^
answer.code:1:2: error: stray ‘#’ in program
    1 | \#include<bits/stdc++.h>
      |  ^
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:11: error: ‘bits’ was not declared in this scope
    1 | \#include<bits/stdc++.h>
      |           ^~~~
answer.code:1:16: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
    1 | \#include<bits/stdc++.h>
      |                ^~~~
      |                std
answer.code:1:3: error: ‘include’ does not name a type
    1 | \#include<bits/stdc++.h>
      |   ^~~~~~~
answer.code: In function ‘void solve()’:
answer.code:16:5: error: ‘string’ was not declared in this scope
   16 |     string s;
      |     ^~~~~~
answer.code:17:5: error: ‘cin’ was not declared in this scope
   17 |     cin >> s;
      |     ^~~
answer.code:17:12: error: ‘s’ was not declared in this scope
   17 |     cin >> s;
      |            ^
answer.code:32:5: error: ‘cout’ was not declared in this scope
   32 |     cout << s[id] << "\n";
      |     ^~~~
answer.code: In function ‘int main()’:
answer.code:37:5: error: ‘cin’ was not declared in this scope
   37 |     cin >> t;
      |     ^~~