319 条题解

  • 6
    @ 2017-09-03 11:29:31
    #include<iostream>
    using namespace std;
    int main(){
        int i,a,b,s=0,j;
        for(i=1;i<=7;i++){
            cin >> a >> b;
            if(a+b>s){
                 s=a+b;
               j=i;
            }
        }  
        if(s<=8) cout << 0;
        else cout<<j; 
        return 0;
    }  
    
  • 3
    @ 2018-08-18 14:08:19

    非常简短(?????)

    
    #include<iostream>
    using namespace std;
    int a[8];
    int main()
    {
        int ma=0;
        for(int i=1;i<=7;i++)
        {
            int c,b;
            cin>>c>>b;
            if(c+b>8)
            {
                a[i]=c+b-8;
                if(a[ma]<a[i]) ma=i;
            }
        }
        cout<<ma;
        return 0;
    }
    
    
  • 3
    @ 2017-09-27 19:18:40

    var
    i,a,b,s:longint;
    a1:array[1..7]of longint;
    begin
    for i:=1 to 7 do
    begin
    readln(a,b);
    a1[i]:=a+b;
    if a1[i]>8 then
    begin
    write(i);
    exit;
    end;
    end;
    for i:=1 to 7 do
    if a1[i]<=8 then
    s:=0;
    if s=0 then
    write(0);
    end.

  • 2
    @ 2018-09-13 21:15:05
    #include <iostream>
    using namespace std;
    int main()
    {
        int m,n,i,maxand,anda,max;
        maxand=0;
        for(i=1;i<=7;i++){
            cin>>m>>n;
            anda=m+n;
            if(maxand<anda){
                maxand=anda;
                max=i;
            }
        }
        cout<<max;
    }
    
  • 2
    @ 2018-05-30 20:30:35

    模拟就好
    H2O题
    只是刚来voijs,忘了编译器的版本……
    连万能头文件都过不了
    cpp
    #include<iostream>
    using namespace std;
    int main()
    {
    int x,y,i,max,temp;
    for(i=1;i<=7;i++)
    {
    cin>>x>>y;
    if ((x+y>max)&&(x+y>8))
    {
    max=x+y;
    temp=i;
    }
    }
    cout<<temp;
    return 0;
    }

  • 1
    @ 2019-07-29 22:07:51

    #include<iostream>
    using namespace std;

    int main(){
    int school,mom,total;
    int max=0,week=0;
    for(int i=0;i<7;i++){
    cin>>school>>mom;
    total = school+mom;
    if(total>8 && total>max){
    max = total;
    week = i+1;
    }
    }
    cout<<week<<endl;
    }
    简洁是一种美

  • 1
    @ 2018-11-04 14:08:14

    #include <iostream>
    using namespace std;
    int main()
    {
    int a,b,ans=0;
    for(int i=1;i<=7;i++)
    {
    cin>>a>>b;
    if(a+b>8&&a+b>ans/10)
    ans=(a+b)*10+i; //合并储存目前最不高兴的时间和日期
    }
    cout<<ans%10<<endl;
    system("Pause");
    return 0;
    }

  • 1
    @ 2018-10-25 21:40:24

    Python3
    #刚学python 有大佬分享更简洁的吗

    List = []
    for i in range(7):
    a,b = input().split(" ")
    List.append([int(a),int(b)])

    for i in List:
    if sum(i) > 8:
    print(List.index(i)+1)
    break

  • 1
    @ 2018-09-16 16:08:47

    #include<bits/stdc++.h>
    using namespace std;
    int a[8],m1,m2;
    int main()
    {
    int x,y;
    for(int i=1;i<8;i++)
    {
    cin>>x>>y;

    a[i]=x+y-8;
    if(a[i]>m2)
    {
    m2=a[i];
    m1=i;

    }
    }cout<<m1<<endl;
    return 0;
    }

  • 1
    @ 2018-09-12 18:54:47

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    int x,y,n,m;
    n=0;
    for(int i=1;i<=7;i++){
    cin>>x>>y;
    if(x+y>n){n=x+y;m=i;}
    }
    cout<<m;
    }

  • 1
    @ 2018-08-18 11:18:53
    #include<cstdio>
    int a[20],ans,k;
    int main()
    {
        for(int i=1;i<=7;i++)
        {
            int n=0,m=0;
            scanf("%d%d",&n,&m);
            if(m+n>8)
            {
                if(m+n>ans)
                {
                    ans=m+n;
                    k=i;
                }
            }
            else
                continue;   
        }
        if(k==0)
            printf("0");
        else
            printf("%d",k);
        return 0;
    }
    
  • 1
    @ 2018-08-08 18:27:58

    var
    a,b:array[1..7] of longint;
    f:array[1..7] of longint;
    i,max:longint;
    begin
    max:=-maxlongint;
    for i:=1 to 7 do
    begin
    read(a[i],b[i]);
    f[i]:=a[i]+b[i];
    end;
    for i:=1 to 7 do
    if f[i]>max then max:=f[i];
    for i:=1 to 7 do
    if f[i]=max then begin write(i);break;end;
    end.
    兄弟们,亚索又来祝你们一臂之力了,hasa'gi!

  • 1
    @ 2018-08-07 17:34:02

    c++:

    #include<bits/stdc++.h>
    #define N 100010
    using namespace std;
    int maxv[N];
    int a[N],n=7;
    inline void pushup(int o){maxv[o]=max(maxv[o*2],maxv[o*2+1]);}
    void build(int o,int l,int r){
    int mid=(l+r)/2;
    if(l==r){maxv[o]=a[l];return;}
    build(o*2,l,mid);build(o*2+1,mid+1,r);
    pushup(o);
    }
    int querymax(int o,int l,int r,int ql,int qr){
    int mid=(l+r)/2,ans=-1;
    if(ql<=l&&r<=qr)return maxv[o];
    if(ql<=mid)ans=max(ans,querymax(o*2,l,mid,ql,qr));
    if(qr>mid)ans=max(ans,querymax(o*2+1,mid+1,r,ql,qr));
    return ans;
    }
    int main(){
    for(int i=1;i<=n;i++){
    int x,y;scanf("%d%d",&x,&y);a[i]=x+y;
    }
    build(1,1,n);
    bool flag=false;int maxn=0,day=-1;
    for(int i=1;i<=n;i++){
    int ans=querymax(1,1,n,i,i);
    if(ans<8)continue;
    if(ans>maxn)maxn=ans,day=i;
    }
    if(day==-1)puts("0");else printf("%d\n",day);
    return 0;
    }

  • 1
    @ 2018-08-06 22:14:09
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    
    int main()
    {
        int i;
        int a, b;
        int nohappy;
        int temp = 0, tempday = -1;
        for(i = 0; i < 7; i++)
        {
            scanf("%d%d",&a,&b);
            if((a + b) > 8)
            {
                nohappy = a + b;
                if(temp < nohappy)
                {
                    temp = nohappy;
                    tempday = i;
                }
            }
        }
        printf("%d\n",tempday + 1);
        return 0;
    }
    
    
  • 1
    @ 2018-07-23 11:30:05

    C++AC标程:
    #include <iostream>
    using namespace std;
    int x[10],y[10];//数组x表示津津在学校上课的时间,数组y表示妈妈安排她上课的时间
    int main()
    {
    for (int i=1;i<=7;i++)
    {
    cin>>x[i]>>y[i];
    int sum=x[i]+y[i];//求出一天所用的总时间
    if (sum>8)//如果不高兴
    {
    cout<<i<<endl;//就输出时间最靠前的—天
    return 0;
    }
    }
    cout<<0<<endl;//如果不会不高兴则输出0
    return 0;
    }

  • 0
    @ 2019-08-18 08:52:56

    #include<cstdio>
    #include<iostream>
    #include<string.h>
    using namespace std;
    int main()
    {
    int ans,maxx=0,x,y;
    for(int i=1;i<=7;i++)
    {
    cin>>x>>y;
    if(x+y>=8&&x+y>maxx)
    {
    maxx=x+y;ans=i;
    }
    }
    cout<<ans;
    }

  • 0
    @ 2018-11-03 21:11:13

    Pascal代码
    var
    i,x,y,t,max,k:longint;
    a:array[1..7]of longint;
    begin
    for i:=1 to 7 do
    begin
    readln(x,y);
    t:=x+y;
    if(t>0) and (t>max) then
    begin
    max:=t;
    k:=i;
    end;
    end;
    write(k);
    end.

  • 0
    @ 2018-10-18 23:26:25

    可能是最简单的代码~~~

    package main
    
    import (
        "fmt"
    )
    
    func main() {
        a, b, s, n := 0, 0, 0, 0
        for i := 1; i <= 7; i ++ {
            fmt.Scanf("%d %d", &a, &b)
            if a + b >= 8 && a + b > s {
                s, n = a + b, i
            }
        }
        fmt.Println(n)
    }
    
  • 0
    @ 2018-07-15 09:37:21

    #include<bits/stdc++.h>
    #include<iostream>
    #include<cstring>
    using namespace std;
    int x[10000],b[10000];
    int cmp(int x,int y)
    {
    return x>y;
    }
    int main()
    {
    int n,m;

    for(int i=1;i<=7;i++)
    {
    cin>>n>>m;
    x[i]=m+n;
    b[i]=x[i];
    }
    sort(b+1,b+1+7,cmp);
    for(int i=1;i<=7;i++)
    {
    if(x[i]==b[1])
    {cout<<i;return 0;
    }
    }

    }

  • 0
    @ 2018-02-28 12:54:31

    #include<iostream>
    using namespace std;
    int a[5343];
    int b[3456];
    int main()
    {
    int n,m,t=0,j;
    for (int i=0;i<7;i++)
    {
    cin>>n>>m;
    a[i]=n+m;
    if(a[i]>t)
    {
    t=a[i];
    j=i+1;
    }
    }
    if (t<=8) cout<<0;
    else cout<<j;

    return 0;
    }

信息

ID
1113
难度
2
分类
模拟 点击显示
标签
递交数
10785
已通过
6392
通过率
59%
上传者