332 条题解

  • 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;
    }
    
    
  • 2
    @ 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.

  • 1
    @ 2023-08-08 12:59:34
    
    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int a,b,c,k=0,kk=0;
        for(int i=1;i<=7;i++)
        {
            cin>>b>>c;;
            if(b+c>kk)
            {
                k=i;
                kk=b+c;
            }
        }
        cout<<k;
        return 0;
    }
    
    
  • 1
    @ 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;
    }
    
  • 1
    @ 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;
    }

  • 0
    @ 2022-05-06 20:36:50

    哗哗嗨,我又来咯。
    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    using namespace std;

    int main ()
    {
    long long a,b,s,max=0,i,day=0;//不开long long 见祖宗
    for (i=1;i<8;i++)
    {
    cin>>a>>b;

    s=a+b;

    if ((s>max)&&(s>8)) max=s,day=i;

    }
    cout<<day;
    return 0;

    }

  • 0
    @ 2022-04-07 17:14:34

    C++版

    #include <iostream>
    using namespace std;
    
    int main()
    {
        int n=0,m=0;
        for(int i=0;i<7;i++){
            int a,b;
            cin>>a>>b;
            if ((a+b)>8){
                  if ((a+b)>n){
                    n = a+b;
                    m = i+1;
            }
            }
        }
        cout<<m;
    }
    
  • 0
    @ 2021-11-26 13:00:00
    #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;
    }  
    
    
  • 0
    @ 2021-09-19 09:21:01
    #include<iostream>
    #include<cstdio>
    using namespace std;
    int main()
    {
      int a[8],x,y,i,max=0;
      for(i=1;i<=7;i++)
      {
       cin>>x>>y;  //输入该天上课时间 
       a[i]=x+y;   //每天的上课时间=学校上课时间+补课时间 
       if(a[i]>max&&a[i]>8)
       max=a[i];   //若这天会不高兴,更新最大值 
       }  
       for(i=1;i<=7;i++) 
       {  
          if(a[i]==0)
          {
          continue;//如果津津没上课,跳出此次循环 
          } 
        if(a[i]==max)//找到最不高兴最靠前的一天 
        {  cout<<i;
           break;    //正常退出程序 
        }
        if(max==0)   //如果津津不会不高兴,输出0 
        { 
          cout<<"0";
          break; 
           } 
       }
       if(a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0&&a[7]==0) 
       cout<<"0";
    return 0;   
    }
    
    
    
    
  • 0
    @ 2021-06-13 10:48:35

    #include <iostream>
    using namespace std;
    int bgx,a,b,zdz;
    int main(){
    for(int i=0;i<7;i++){
    cin>>a>>b;
    if(a+b>8&&a+b>bgx)bgx=a+b,zdz=i+1;
    }
    cout<<zdz;
    return 0;
    }

  • 0
    @ 2021-06-13 10:48:27

    #include <iostream>
    using namespace std;
    int bgx,a,b,zdz;
    int main(){
    for(int i=0;i<7;i++){
    cin>>a>>b;
    if(a+b>8&&a+b>bgx)bgx=a+b,zdz=i+1;
    }
    cout<<zdz;
    return 0;
    }

  • 0
    @ 2021-02-04 16:03:59

    #include<iostream>
    using namespace std;

    int main()

    {

    int a[8],s1,s2,max=0,max1=0;

    for(int q=1;q<=7;q++)
    {
    cin>>s1>>s2;
    a[q]=s1+s2;
    }

    for(int w=1;w<=7;w++)
    {

    if(a[w]>8&&a[w]>max1)max1=a[w],max=w;
    }

    cout<<max;
    }

  • 0
    @ 2020-12-26 14:41:37

    #include<stdio.h>
    int main()
    {
    int a, b,s = 0,i,j;
    for (i = 0; i < 7; i++)
    {
    scanf_s("%d %d", &a, &b);
    if ((a + b > 8) && (a + b > s))
    {
    s = a + b;
    j = i + 1;
    }
    }
    printf("%d\n", j);
    return 0;
    }

  • 0
    @ 2020-11-28 20:19:35

    又是一道深基题,直接暴力膜你就完了呗!//(你完全不需要考虑脑子的存在)
    请勿抄袭
    下附代码:

    #include<iostream>
    #include<cstdio>
    using namespace std;
    struct bal
    {
        int home,sch;
    }sum[21];
    struct bala
    {
        int sum,p;
    }ans;
    int main()
    {
        ans.sum=8;
        for(int i=1;i<=7;i++)
        {
            int num;
            cin>>sum[i].sch>>sum[i].home;
            num=sum[i].home+sum[i].sch;
            if(num>ans.sum)
            {
                ans.p=i;
                ans.sum=num;
            }
        }
        if(ans.p==0)
        cout<<"0"<<endl;
        else
        cout<<ans.p<<endl;
        return 0;
    }
    

    自己慢慢看吧,就是一篇来自初学者的代码。。。

    • @ 2022-04-07 17:17:46

      这样更简短hahahaha

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

      自己慢慢看吧,就是一篇来自编程入门者的代码。。。

  • 0
    @ 2020-10-31 12:14:42

    #include<iostream>
    using namespace std;
    int main()
    {
    int school[7]={0},free_time[7]={0},num[7]={0},time=0,days=0;
    for(int i=0;i<=6;i++)
    {
    cin>>school[i]>>free_time[i];
    num[i]=school[i]+free_time[i];
    if(num[i]>time)
    {
    time=num[i];
    days=i+1;
    }
    }
    if(time>8) cout<<days;
    else cout<<"0";
    return 0;
    }

  • 0
    @ 2020-06-27 14:06:17
    #include<iostream>
    using namespace std;
    
    int main(void) {
        int s, e;
        for (int i = 0; i < 7; i++) {
            scanf("%d %d", &s, & e);
            getchar();
            if (s + e > 8) {
                printf("%d\n", i + 1);
                break;
            }
        }
        return 0;
    }
    
  • 0
    @ 2019-09-26 19:30:26

    看了大家的解答我真是自愧不如,既要和8比较又要和上一组数据比较混在一起,关系很是混乱,不如直接和上一组数据比较,比较出最大的一组,最后看最大的是否超过8即可。

  • 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
    @ 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;
    }
    简洁是一种美

    • @ 2022-04-07 17:22:24

      是的确实如此(不用数了,12行)

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

信息

ID
1113
难度
2
分类
模拟 点击显示
标签
递交数
11399
已通过
6745
通过率
59%
被复制
39
上传者