mc_xiexie @ 2023-10-04 15:59:04
代码(最高只有20分)
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[255],b,c,d;
for(int i=1;i<=9;i++)
{
cin>>a[i];
}
cin>>b;
d=b+30;
for(int n=1;n<=10;n++)
{
if(d>=a[n])
{
c++;
}
}
cout<<c;
}
by IceKylin @ 2023-10-04 16:00:34
@mc_xiexie
for(int i=1;i<=9;i++)
中改为 i<=10
by Hatsunatsu @ 2023-10-04 16:04:29
将第一个循环改为 for(int i=1;i<=10;i++)
by Hatsunatsu @ 2023-10-04 16:04:53
@mc_xiexie
by mc_xiexie @ 2023-10-04 16:04:58
已经改成正确答案了,只是觉得很神奇。
@IceKylin
by IceKylin @ 2023-10-04 16:06:38
@mc_xiexie
读入 10 个数,循环肯定要到 10 啊。
建议再复习一下循环
by kimi0705 @ 2023-10-16 17:06:52
@IceKylin %%%