求助!最后一个点过不了!(C++)
查看原帖
求助!最后一个点过不了!(C++)
781494
hyx810913楼主2022/8/31 14:11
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a[7]={},b[7]={};
	for(int i=0;i<7;i++){
		cin>>a[i]>>b[i];
	}
	int c[7]={};
	for(int i=0;i<7;i++){
		c[i]=a[i]+b[i];
	}
	bool d[7]={};
	for(int i=0;i<7;i++){
		d[i]=true;
	}
	for(int i=0;i<7;i++){
		if(c[i]>8){
			d[i]=false;
		}
	}
	int maxn=0;
	for(int i=0;i<7;i++){
		if(!d[i]){
			if(c[i]>maxn){
				maxn=c[i];
			}
		}
	}
	for(int i=0;i<7;i++){
		if(maxn==c[i]){
			cout<<i+1;
			return 0;
		}
	}
	return 0;
}
2022/8/31 14:11
加载中...