有什么问题

P1046 [NOIP2005 普及组] 陶陶摘苹果

shuaige999hao @ 2022-11-04 22:05:24

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,n=0;
    cin>>a;
    for(int i=0;i<10;i++)
    {
        int k;
        cin>>k;
        if(k-a<=30)
        {
            n++;
        }
    }
    cout<<n;
}

by MysteriousEast @ 2022-11-04 22:09:32

a在最后输入


by MysteriousEast @ 2022-11-04 22:09:46

#include<bits/stdc++.h>
using namespace std;
int num[15];
int main()
{
    int a,ans=0;
    for(int i=0;i<10;i++) cin>>num[i];
    cin>>a;
    for(int i=0;i<10;i++) 
        if(num[i]-a<=30) ans++;
    cout<<ans;
}

by MysteriousEast @ 2022-11-04 22:12:03

@shuaige999hao


by shuaige999hao @ 2022-11-04 22:42:01

谢谢


|