样例能过,但测试不行

P5741 【深基7.例10】旗鼓相当的对手 - 加强版

``` stud[i].chi+stud[i].mat+stud[i].eng-stud[j].chi+stud[j].mat+stud[j].eng ``` 这样例能过?
by 编码落寞 @ 2023-10-25 11:24:35


楼上正解
by Shen_Linwood @ 2023-10-25 12:35:33


```c #include<bits/stdc++.h> using namespace std; struct hyq{ string g; int scs,cs,s; }a[1005]; int main() { int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].g>>a[i].scs>>a[i].cs>>a[i].s; } for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ int b=a[i].scs-a[j].scs; int c=a[i].cs-a[j].cs; int d=a[i].s-a[j].s; int y,u,o; y=b; u=c; o=d; int p=y+u+o; if(y+u+o<0){ p=(y+u+o)*-1; }if(b<0){ b*=-1; }if(c<0){ c*=-1; }if(d<0){ d*=-1; }if(b<=5&&c<=5&&d<=5&&p<=10&&p>=0){ cout<<a[i].g<<" "<<a[j].g<<endl; } } } return 0; } ```
by yc123bc @ 2023-11-11 13:14:38


|