为什么不行?
2025-09-15 19:29:12
发布于:浙江
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,s[7];
for(int i=0;i<=7;i++){
cin>>a>>b;
s[i]=a+b;
}
int x=-1;
for(int i=0;i<=7;i++){
if(s[i]>x){
x=s[i];
}
}
cout<<x;
return 0;
}
why?
全部评论 7
赞同panda
1周前 来自 浙江
0你这是cout时间长度,也就是9小时,但是题目要求星期,也就是i=3的时候,输出i,
你用num=i,最后cout<<num
#include <iostream>
using namespace std;
int main(){
int max=0,cnt=0;long long a1,a2,b=0;
for(int i=1;i<=7;i++){
cin>>a1>>a2;
if(a1+a2>8&&a1+a2>=max){max=a1+a2;b=i;}
}cout<<b<<'\n';
return 0;
}2026-05-23 来自 广东
0ivfhgv n vhvgnjhv jvgjvgjbg
2026-04-17 来自 四川
078
2026-02-07 来自 重庆
0《周0是周几?》
2026-02-07 来自 上海
0我Python代码都比你快!
代码如下:
l=[]
inp=[]
unhappy=[]
for i in range(7):
inp=input().split(" ")
inp[0]=int(inp[0])
inp[1]=int(inp[1])
l.append(inp)
for i in l:
if sum(i)>7:
unhappy.append(sum(i))
else:
unhappy.append(0)
if sum(unhappy)==0:
print(0)
else:
x=max(unhappy)
for i in range(len(unhappy)):
if unhappy[i]==x:
print(i+1)
break2025-12-21 来自 北京
0#include<bits/stdc++.h>
using namespace std;
int main(){
int a, b;
int max_val=-1;
int day=0;
for (int i=0;i<7;i++) {
cin>>a>>b;
int t=a+b;
if (t>8) {
if (t>max_val) {
max_val=t;
day=i+1;
}
}
}
if (day==0) {
cout<<0;
} else {
cout<<day;
}
return 0;
}2025-09-15 来自 上海
0别问,问就是太闲了
2025-09-15 来自 上海
0



































有帮助,赞一个