求助啊求助!怎么只有40分啊QaQ

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

uenohara_ayano @ 2023-02-25 15:03:09

大佬救救我……

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

by Mr_Biantainne @ 2023-02-25 15:17:54

把high>=a到high>=j判断全去掉


by digua2010 @ 2023-02-25 15:18:30

建议你看看题解学一下别人的思路


by uenohara_ayano @ 2023-02-25 16:05:37

@C20220215 为什么啊??


by Mr_Biantainne @ 2023-02-25 20:02:33

@kisara_qwq 原来不踩板凳就能摘到的苹果重复算了


by whatfuck @ 2023-04-09 21:40:05

一.数组如:a[11] 二.把桃桃身高开始加三十,后面加30减掉……


by SCP5543 @ 2023-05-14 09:14:49

其实可以直接用陶陶身高+凳子高来判断是否能摘到


|