C++正解

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

我爱草泥马 @ 2017-09-10 20:08:14

#include<stdio.h>
int main(){
    int i,a[10],b,c,flag;
    for(i=0;i<10;i++){
        scanf("%d",&a[i]);
    }   
    scanf("%d",&b);
    c=b+30;
    flag=0;
    for(i=0;i<10;i++){
        if(c>=a[i]){
            flag=flag+1;
        }   
    }   
    printf("%d\n",flag);
    return 0;
}
我姓雷名锋谢谢[奸笑]

by 我爱草泥马 @ 2017-09-10 20:10:12

自顶


by dying @ 2018-02-07 18:15:40

include<bits/stdc++.h>

int main(){ int a[10],b,c=0; for(int i=0;i<=9;i++)scanf("%d",&a[i]); scanf("%d",&b);b+=30; for(int i=0;i<=9;i++)if(a[i]<=b)c++; printf("%d",c); return 0; } 麻烦


|