QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#623006#7894. Many Many HeadsL_tyCompile Error//C++20763b2024-10-09 09:32:162024-10-09 09:32:16

Judging History

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

  • [2024-10-09 09:32:16]
  • 评测
  • [2024-10-09 09:32:16]
  • 提交

answer

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const  int N = 1e5 + 10;
char s[N];
void solve(){
    cin >> s + 1;
    int n = strlen(s + 1);
   // cout << n << endl;
    vector<int> v(n + 1);
    int a = 0, b = 0,flag=0;
    for (int i = 1;i<=n;i++){
        if(s[i]==')'||s[i]=='(')
            v[i] = 1,a++;
        else
            v[i] = 2,b++;
        if(a%2==0&&b%2==0)
            flag  ++;
       // cout << a << " " << b << endl;
    }
    if(flag==1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
signed main(){
     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
     int t;
     cin>>t;
     while(t--){
         solve();
     }
}

详细

answer.code: In function ‘void solve()’:
answer.code:9:9: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘char*’)
    9 |     cin >> s + 1;
      |     ~~~ ^~ ~~~~~
      |     |        |
      |     |        char*
      |     std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/iostream:42,
                 from answer.code:1:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:9:14: error: cannot bind non-const lvalue reference of type ‘void*&’ to an rvalue of type ‘void*’
    9 |     cin >> s + 1;
      |            ~~^~~
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:9:14: error: invalid conversion from ‘char*’ to ‘long long unsigned int’ [-fpermissive]
    9 |     cin >> s + 1;
      |            ~~^~~
      |              |
      |              char*
answer.code:9:14: error: cannot bind rvalue ‘(long long unsigned int)(((char*)(& s)) + 1)’ to ‘long long unsigned int&’
/usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:9:14: error: invalid conversion from ‘char*’ to ‘long long int’ [-fpermissive]
    9 |     cin >> s + 1;
      |            ~~^~~
      |              |
      |              char*
answer.code:9:14: error: cannot bind rvalue ‘(long long int)(((char*)(& s)) + 1)’ to ‘long long int&’
/usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:9:14: error: invalid conversion from ‘char*’ to ‘long unsigned int’ [-fpermissive]
    9 |     cin >> s + 1;
      |            ~~^~~
      |              |
      |              char*
answer.code:9:14: error: cannot bind rvalue ‘(long unsigned int)(((char*)(& s)) + 1)’ to ‘long unsigned int&’
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:188:7: note:   conversion of argument 1 would be ill-formed:
answer.code:9:14: error: invalid conversion from ‘char*’ to ‘long int’ [-fpermissive]
    9 |     cin >> s + 1;
      |            ~~^~~
      |              |
      |              char*
answer.code:9:14: error: cannot bind rvalue ‘(long int)(((char*)(& s)) + 1)’ to ‘long int&’
/usr/include/c++/13/istream:184:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:184:7: note:   conversion of argument 1 would be ill-formed:
answer.code:9:14: error: invalid conversion from ‘char*’ to ‘unsigned int’ [-fpermissive]
    9 |     cin >> s + 1;
      |            ~~^~~
      |              |
      |              char*
answer.code:9:14: error: cannot bind rvalue ‘(unsigned int)(((char*)(& s)) + 1)’ to ‘unsigned int&’
/usr/include/c++/13/istream:181:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/13/istream:181:7: note:...