这个思路对吗?

P4715 【深基16.例1】淘汰赛

附上程序:``` #include<bits/stdc++.h> using namespace std; int main() {int a,b=1,n=-10000,m=-10000; cin>>a; for(int q=0;q<a;q++) { b=b*2; } b=b/2; int c[b],d[b]; for(int q=0;q<b;q++) {cin>>c[q]; if(c[q]>=n) {n=c[q]; } } for(int q=0;q<b;q++) {cin>>d[q]; if(d[q]>=m) {m=d[q]; } } if(m>n) {cout<<n; } else {cout<<m; } return 0; } ```
by 吴锦洋 @ 2020-10-07 10:34:26


希望更丰富的展现?使用Markdown
by Textbook_blasphemy @ 2020-10-07 10:56:56


哦,我发现了,我输出的是实力值,应该输出国家的号数。
by 吴锦洋 @ 2020-10-08 12:52:16


AC程序: ``` #include<bits/stdc++.h> using namespace std; int main() {int a,b=1,n=-10000,m=-10000,z=0,x=0; cin>>a; for(int q=0;q<a;q++) { b=b*2; } b=b/2; int c[b],d[b]; for(int q=0;q<b;q++) {cin>>c[q]; if(c[q]>=n) {n=c[q]; z=q; } } z++; x=b; for(int q=0;q<b;q++) {cin>>d[q]; if(d[q]>=m) {m=d[q]; x=b+q; } } x++; if(m>n) {cout<<z; } else {cout<<x; } return 0; } ```
by 吴锦洋 @ 2020-10-08 12:53:50


|