只有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 Hyper_zero @ 2024-08-14 15:50:25

@yz54188

#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;
    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+30>=i)
    {
        l=l+1;
    }
    if(k+30>=j)
    {
        l=l+1;
    }
    cout<<l;
}

by zhuyucheng6046 @ 2024-08-14 15:51:35

@yz54188 @Hyper_zero What?

#include<bits/stdc++.h>
using namespace std;
int main(){
    int sum=0;
int a[10];
int b;
for(int i=0;i<10;i++)
cin>>a[i];
cin>>b;
for(int i=0;i<10;i++)
{
    if(a[i]<=b+30)
    sum++;
}
cout<<sum<<endl;
return 0;
 }

by Hyper_zero @ 2024-08-14 15:51:39

你可以使用数组qwq


by goodwepb1 @ 2024-08-14 15:52:17

#include <iostream>
using namespace std;
int height[20],H,s;
int main()
{
    for(int i=0;i<10;i++)cin >> height[i];
    cin >> H;
    H += 30;
    for(int i=0;i<10;i++)s+=!(H<height[i]);
    cout << s;
}

我勒个打表


by Hyper_zero @ 2024-08-14 15:52:29

@zhuyucheng6046 我不知道lz有没有学过数组qwq


by Hyper_zero @ 2024-08-14 15:54:32

@75lige 这不算打表吧


by goodwepb1 @ 2024-08-14 15:56:20

@Hyper_zero 他那个代码算半个打表


by zhuyucheng6046 @ 2024-08-14 15:57:07

@Hyper_zero 我学数组时也走了不少弯路,就是搞不懂下标。o(╥﹏╥)o(现在会了)


by Hyper_zero @ 2024-08-14 15:57:21

@75lige 彳亍


by goodwepb1 @ 2024-08-14 15:58:31

@Hyper_zero 痞子说话


| 下一页