1 条题解

  • 0
    @ 2025-4-7 21:38:01

    C++ :

    #include<iostream>
    #include<cstdio>
    using namespace std;
    int main(){
    	//freopen("unhappy.in","r",stdin);
    	//freopen("unhappy.out","w",stdout);
    	int i,a[8][4],sum=0,k=0;
    	for(i=1;i<=7;i++){
    		cin>>a[i][1]>>a[i][2];
    		a[i][3]=a[i][1]+a[i][2];
    		if(a[i][3]>sum&&a[i][3]>8){
    		sum=a[i][3];k=i;}
    	}
    	cout<<k;
    	return 0;
    }
    

    Pascal :

    program unhappy; {writen by lxq 2004.11.20}
    var a,i,x,y,d,max : byte;
    begin
    
      d := 0; max :=8;
      for i := 1 to 7 do begin
        readln(x,y);
        a := x+y;
        if a>max then 
        begin
          max :=a; d := i;
        end;
      end;
      writeln(d);
      close(input); close(output);
    end.
    
    • 1

    信息

    ID
    1782
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者