332 条题解
-
0Yakult100mL LV 8 @ 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;
} -
02018-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. -
02018-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 -
02018-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) }
-
02018-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;
} -
02018-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;
} -
02018-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; }
-
02018-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! -
02018-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;
} -
02018-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; }
-
02018-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;
} -
02018-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;
}
}}
-
02018-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;
} -
02017-12-26 14:22:36@
#include<bits/stdc++.h>
using namespace std;
int main(){
int n[8],e[8],all[8],x=-1,day;
for(int i=1;i<=7;i++){
cin>>n[i]>>e[i];
}
for(int i=1;i<=7;i++){
all[i]=n[i]+e[i];
if (x<all[i])
x=all[i];
}
if (x<=8)
cout<<"0"<<endl;
for(int i=1;i<=7;i++){
if (all[i]==x){
day=i;
break;
}
}
cout<<day<<endl;return 0;
} -
02017-12-03 14:56:28@
#include<stdio.h>
int main()
{
int a,b,c[8]={0},d;
for(int i=1;i<=7;i++)
{
scanf("%d%d",&a,&b);
c[i]=a+b;
if (c[i]>8&&c[i]>c[0])
{
c[0]=c[i];
d=i;
}
}
printf(c[0]==0?"0":"%d",d);
return 0;
} -
02017-11-06 22:10:13@
#include<iostream>
#inlcude<cmath>
#include<cstring>
#inlcude<cstdio>
#include<cstdlib>
#inlcude<algorithm>
using namespace std;
int main()
{
int a,b,i,max,maxday,s;
max=8;
maxday=0;
for(i=1;i<=7;i++)
{
cin>>a>>b;
s=a+b;
if(s>max)
{
max=s;
maxday=i;
}
}
cout<<maxday<<endl;
system ("pause");
return 0;
} -
02017-10-20 22:32:13@
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. -
02017-09-23 20:51:07@
#include<iostream>
using namespace std;
int main()
{
int shangke, kewai,total[7],max=0,day=0;
for (int i = 0; i < 7; i++)
{
cin >> shangke >> kewai;
total[i] = shangke + kewai;
}
max = total[0];
for (int i = 0; i < 7; i++)
if (max < total[i])
max = total[i];
for (int i = 0; i < 7; i++)
if (max == total[i])
{
day = i + 1;
break;
}
cout << day << endl;
return 0;
} -
02017-08-20 10:50:41@
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int flag = 0;
final int DAYS = 7;
int[] hours = new int[DAYS];for (int i = 0; i < DAYS; i++) {
int a = in.nextInt();
int b = in.nextInt();hours[i] = a + b;
if (hours[i] > hours[flag]) {
flag = i;
}
}if (hours[flag] <= 8) {
System.out.println(0);
}else {
System.out.println(flag + 1);
}
}}
-
02017-08-10 22:06:44@
var ans,i,c:integer; a,b:array[1..7] of integer;
begin
ans:=0;
for i:=1 to 7 do
read(a[i],b[i]);
for i:=1 to 7 do if (a[i]+b[i]>8)and(a[i]+b[i]>ans) then begin ans:=a[i]+b[i]; c:=i; end;
writeln(c);
end.