Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
418 关清声 长方形排序 C++ Compile Error 0 MS 0 KB 824 2022-08-17 10:35:10

Tests(0/0):


Code:

#include<iostream> #include<cstring> #include<algorithm> struct fri { long long t; long long b; long long n[10]; }; int as(fri x,fri y) { return x.b>y.b; } using namespace std; int main() { int n; cin>>n; struct fri a[n]; for(int i=0;i<n;i++) { cin>>a[i].b>>a[i].n>>a[i].t; } sort(a,a+n,as); for(int i=0;i<n;i++) { for(int l=0;l<n;l++) { if(a[l].b==a[l+1].b) { if(a[l].n>a[l+1].n) { swap(a[l],a[l+1]); } else if(strcmp(a[l].n,a[l+1].n)==0) { if(a[l].t>a[l+1].t) { swap(a[l],a[l+1]); } else if(a[i].t==a[l].t) { for(int j=l;j<n;j++) { a[j]=a[j+1]; } } } } } } for(int i=0;i<n;i++) { cout<<a[i].n<<" "<<a[i].b<<" "<<a[i].t<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:22:6: error: cannot bind 'std::basic_istream::__istream_type {aka std::basic_istream}' lvalue to 'std::basic_istream&&'
   cin>>a[i].b>>a[i].n>>a[i].t;
      ^
In file included from /usr/include/c++/4.8.2/iostream:40:0,
                 from Main.cc:1:
/usr/include/c++/4.8.2/istream:872:5: error:   initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits; _Tp = long long int [10]]'
     operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
     ^
Main.cc:35:35: error: cannot convert 'long long int*' to 'const char*' for argument '1' to 'int strcmp(const char*, const char*)'
     else if(strcmp(a[l].n,a[l+1].n)==0)
                                   ^