332 条题解
-
0痞子熊 LV 7 @ 2017-07-30 22:45:05
#include <iostream>
using namespace std;
int main(){
int a[7][2];
int d[7];
int b,c,e;
for(b=0;b<7;b++)
{
for(c=0;c<2;c++)
{
cin>>a[b][c];
}
}
for(b=0;b<7;b++){
d[b]=a[b][0]+a[b][1];
}
b=0;
for(c=0;c<7;c++)
{
if(d[c]>b)
{
e=c+1;
b=d[c];
}
}
if(b<8)
{
cout<<0;
}
else
{
cout<<e;
}
return 0;
} -
02017-07-28 21:15:18@
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a[10]={9,6,3,8,5,2,7,4,1,0};
for(int i=0;i<10;i++)
cout<<a[i]<<endl;
sort(a,a+10);
for(int i=0;i<10;i++)
cout<<a[i]<<endl;
return 0;
} -
02017-07-22 16:55:03@
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cctype>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cassert>
#include <map>
#include <string>
#include <sstream>
#include <ctime>
using namespace std;
int z1[10],z2[10];
int main()
{
int s=0;
for(int i=1;i<=7;i++)
{
scanf("%d%d",&z1[i],&z2[i]);
}
for(int i=1;i<=7;i++)
{
for(int j=1;j<=7;j++)
{
if(z1[i]+z2[i]>=9)
{
s=i;
if((j<i&&z1[j]+z2[j]==z1[i]+z2[i])||z1[j]+z2[j]>z1[i]+z2[i])
{
s=j;
printf("%d",s);
return 0;
}
else
{
printf("%d",s);
return 0;
}
}
}
}
return 0;
} -
02017-07-20 19:22:39@
#include<iostream>
using namespace std;
int main()
{
int a,b,i,c=0,d=0;
for(i=1;i<=7;i++)
{
cin>>a>>b;
if(a+b>c)
{
c=a+b;
d=i;
}
}
if(c>8)cout<<d;
else cout<<"0";
return 0;
} -
02017-07-18 12:28:33@
#include<iostream>
using namespace std;
int main()
{
int i,a,b,c,day,max=0;
for(i=1;i<=7;i++)
{
cin>>a>>b;
c=a+b;
if(c<=8) continue;
if(c>max)max=c,day=i;
}
cout<<day<<endl;
return 0;
} -
02017-07-18 12:28:01@
#include<iostream>
using namespace std;
int main()
{
int i,a,b,c,day,max=0;
for(i=1;i<=7;i++)
{
cin>>a>>b;
c=a+b;
if(c<=8) continue;
if(c>max)max=c,day=i;
}
cout<<day<<endl;
return 0;
} -
02017-07-18 11:23:10@
#include<iostream>
using namespace std;
int main ()
{
int i,m,n,a=0,day=0;
for(i=1;i<=7;i++)
{
cin>>m>>n;
if(m+n<=8) continue;
if(m+n>a)
{
day=i;
a=m+n;
}
}
cout<<day;
return 0;
}C++
-
02017-07-18 11:22:19@
#include<iostream>
using namespace std;
int main ()
{
int i,m,n,a=0,day=0;
for(i=1;i<=7;i++)
{
cin>>m>>n;
if(m+n<=8) continue;
if(m+n>a)
{
day=i;
a=m+n;
}
}
cout<<day;
return 0;
}C++ for循环
-
02017-07-13 15:18:41@
来来来!!!
#include<iostream> using namespace std; int main() { int i,a,b,c,d=0,k; i=1; while (i<=7){ cin>>a>>b; c=a+b; if(c>=8){ if(d<c){ d=c; k=i; } } ++i; } cout<<k<<endl; return 0; }
-
02017-06-20 17:51:45@
#include<iostream>
using namespace std;
int i,m,n,ma=0,day=0;
int main()
{
for(i=1;i<=7;i++)
{
cin>>m>>n;
if(m+n<8) continue;
if(ma<n+m)
{
day=i;
ma=n+m;
}
}
cout<<day;
return 0;
} -
02017-06-15 18:15:56@
Var
a,b,i,s,max:integer;
c:array[1..7]of integer;
Begin
for i:=1 to 7 do
begin
read(a,b);
c[i]:=a+b;
readln;
end;
max:=0; s:=0;
for i:=1 to 7 do
if (c[i]>8) and (c[i]>max) then
begin
max:=c[i];
s:=i;
end;
write(s);
End. -
02017-06-01 23:22:38@
#include<iostream>
using namespace std;
int i,m,n,ma=0,day=0;
int main()
{
for(i=1;i<=7;i++)
{
cin>>m>>n;
if(m+n<8) continue;
if(ma<n+m)
{
day=i;
ma=n+m;
}
}
cout<<day;
return 0;
} -
02017-05-25 17:36:08@
#include<iostream> using namespace std; int main() { int i,j,k,max=0,day; for(i=1;i<=7;i++) { cin>>j>>k; if(max<j+k && j+k>=8) { max=j+k; day=i; } } if (max==0) cout<<max; else cout<<day; }
-
02017-03-10 20:33:09@
AC没毛病老铁~!
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int a[8],c=0,d,e,f;
for (d=1;d<=7;d++){
cin>>e>>f;
a[d]=e+f;
}
for (d=1;d<=7;d++){
if (a[d]>8){
c=d;
break;
}
}
cout<<c<<endl;
return 0;
} -
02016-11-10 20:51:46@
var
s,k,max,maxd,i:integer;
begin
max:=0;
maxd:=0;
for i:=1 to 7 do
begin
read(s);
readln(k);
if (s+k) >=8 then
if max < (s+k) then
begin
maxd:=i;
max:=s+k;
end;
end;
writeln(maxd);
end. -
02016-10-29 13:15:24@
#include <iostream> using namespace std; int a[10]; int main() { int i,j,n,num=0; for(n=1;n<=7;n++) { cin>>i>>j; a[n]=i+j; } for(n=1;n<=7;n++) { if(a[n]>8) { num=n; break; } } cout<<num<<endl; return 0; }
-
02016-10-13 20:01:25@
Python:
a=[0]*8;
b=[0]*8;
ans=0;
ans2=0;
i=1;
while i<=7:
s=raw_input();
s2=s.index(' ');
j=0;
while j<s2:
a[i]=a[i]*10+int(s[j]);
j=j+1;
j=s2+1;
while j<len(s):
b[i]=b[i]*10+int(s[j]);
j+=1;
if a[i]+b[i]>ans:
ans=a[i]+b[i];
ans2=i;
i+=1;
print ans2; -
02016-10-11 22:03:19@
C++
#include<iostream>using namespace std;
int main(){
int a[8][3];
for(int i=0;i<7;i++){
cin>>a[i][1]>>a[i][2];
}
int b[8];
for(int u=0;u<7;u++){
b[u]=a[u][1]+a[u][2];
}
int max1=0;
int max=0;
for(int o=0;o<7;o++){
if(b[o]>8 && b[o]>max1){
max1=b[o];
max=o+1;
}
}
cout<<max<<endl;
} -
02016-09-17 20:11:29@
//低内存和短代码的简易结合
#include<iostream>
using namespace std;
int i,a,b,maxn=0,day=0;
int main(){
for(i=1;i<=7;i++){
cin>>a>>b;
if(a+b<8) continue;
if(maxn<a+b){
day=i;maxn=a+b;
}
}
cout<<day;
}
评测结果
编译成功测试数据 #0: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #2: Accepted, time = 15 ms, mem = 564 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 564 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 556 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 560 KiB, score = 10
Accepted, time = 15 ms, mem = 564 KiB, score = 100 -
02016-09-10 10:18:54@
//233333
#include<iostream>
using namespace std;
int main()
{
int a[8],b[8],tot[8],s=0;
tot[0]=0;
for(int i=1;i<=7;i++)
{
cin>>a[i]>>b[i];
tot[i]=a[i]+b[i]-8;
}
for(int i=1;i<=7;i++)
if(tot[i]>0 && tot[i]>tot[s]) s=i;
cout<<s<<endl;
return 0;
}