只有90分求大佬帮忙

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

yz54188 @ 2024-08-14 15:43:07

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f,g,h,i,j,k,l;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k;
    if(a<100,b<100,c<100,d<100,e<100,f<100,g<100,h<100,i<100,j<100||a>100,b>100,c>100,d>100,e>100,f>100,g>100,h>100,i>100,j>200||k<100||k>120)
    {
        return 0;
    }
    l=0; 
    if(k+30>a)
    {
        l=l+1;
    }
    if(k+30>b)
    {
        l=l+1;
    }
    if(k+30>c)
    {
        l=l+1;
    }
    if(k+30>d)
    {
        l=l+1;
    }
    if(k+30>e)
    {
        l=l+1;
    }
    if(k+30>f)
    {
        l=l+1;
    }
    if(k+30>g)
    {
        l=l+1;
    }
    if(k+30>h)
    {
        l=l+1;
    }
    if(k>i||k+30>i)
    {
        l=l+1;
    }
    if(k>j||k+30>j)
    {
        l=l+1;
    }
    cout<<l;
}

by SbsbsB_ @ 2024-08-14 19:34:39

include<bits/stdc++.h>

using namespace std;
int arr[1100];
int main()
{
int n,cnt=0;
for(int i=1;i<=10;i++)
{
cin>>arr[i];
}
cin>>n;
for(int i=1;i<=10;i++)
{
if(n```cpp +30>=arr[i])
{
cnt++;
}
}
cout<<cnt;
return 0;
}


by yz54188 @ 2024-08-16 15:34:29

@Hyper_zero 不会数组


by DZNULI26 @ 2024-08-17 11:07:06

@yz54188 陶陶的站立高度+30后等于苹果的高也算能摘到


by Wang20280214 @ 2024-08-18 20:59:52

@Hyper_zero 彳(chi) 亍(chu)


by tangyiqi @ 2024-08-19 15:01:04

@yz54188
用我的AC代码吧

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20;
int a[MAXN],c = 0,b; 
void pick(int k){
    if(b+30 >= k)c++;
    else return;
}
int main(){
    for(int i = 0;i<10;i++){
        cin>>a[i];
    }
    cin>>b;
    for(int i = 0;i<10;i++){
        pick(a[i]);
    }
    cout<<c<<"\n";
    return 0;
}

求关,谢谢


by machenchang @ 2024-09-06 21:06:22

#include<bits/stdc++.h>
using namespace std;
int main(){
    int num[10];
    int h;
    int sum=0;
    for(int i=0;i<10;i++){
        cin>>num[i];
    }
    cin>>h;

    for(int i=0;i<10;i++){
        if(h+30>num[i]){
            sum++;
        }
    }
    cout<<sum;
    return 0;
} 

by yz54188 @ 2024-10-19 19:55:44

@Hyper_zero 我现在终于学数组了


by yz54188 @ 2024-10-19 19:56:03

@Hyper_zero 我觉得我当时好傻


上一页 |