题解

453 条题解

  • 5
    @ 2017-06-01 23:09:49

    #include<iostream>
    using namespace std ;
    int main()
    {
    int a[100];
    int i;
    for(i=1;i<=10;i++)
    {
    cin>>a[i];
    }
    int j,n;
    cin>>j;
    n=j+30;
    int count=0;
    for(i=1;i<=10;i++)
    if(a[i]<=(n))
    count++;
    cout<<count<<endl;
    return 0;
    }

  • 3
    @ 2017-08-18 02:48:21
    #include <iostream>
    
    int main() {
        long long a[11],b=0,c=0,n,i;
        for(i=1;i<=10;i++)
        {
            scanf("%lld",&a[i]);
        }
        scanf("%lld",&b);
        for(i=1;i<=10;i++)
        {
            if(a[i]<=b+30)
            c++;
        }
        printf("%lld",c);
        return 0;
    }
    
  • 3
    @ 2017-04-07 23:17:43

    很简单的想法
    #include<iostream>
    #include<cstdio>
    using namespace std;

    int main()
    {
    int n,a[10],b=0,d;
    for(int i=0;i<10;i++) scanf("%d",&a[i]);
    cin>>n;
    d=n+30;
    for(int i=0;i<10;i++)
    {
    if(a[i]<=d) b++;
    }
    cout<<b;
    return 0;
    }

  • 2
    @ 2022-08-13 12:33:05

    这是一道特别傻的题
    大概入门水平
    话不多说,代码飞来!

    #include<iostream>
    using namespace std;
    int main(){
        int a[10],i,k,he=0;
        for(i=0;i<10;i++){
            cin>>a[i];
        }
        cin>>k;
        for(i=0;i<10;i++){
            if(a[i]<=30+k){
                he++;
            }
        }
        cout<<he;
        return 0;
    }
    
  • 1
    @ 2024-03-26 22:38:37
    #include <bits/stdc++.h>
    using namespace std;
    int x, n, a[1005];
    int main() {
        ios::sync_with_stdio(false);
        n = 10;
        for (int i = 1; i <= n; i ++) cin >> a[i];
        cin >> x;
        x += 30;
        int cnt = 0;
        for (int i = 1; i <= n; i ++) if (a[i] <= x) cnt ++;
        cout << cnt;
        return 0;
    }
    
  • 1
    @ 2023-05-15 19:11:55

    666
    #include<iostream>
    using namespace std;
    int main()
    {
    int a[10]={};
    int j,k,ans=0;
    for(k=0;k<10;k++){
    cin>>a[k];
    }
    cin>>j;
    for(k=0;k<10;k++){
    if(j+30>=a[k]) ans++;
    }
    cout<<ans;
    }
    建议大家看看苹果摘陶陶和陶陶抢苹果

  • 1
    @ 2021-02-04 12:12:47
    #include <iostream>
    using namespace std;
    int main()
    {
        int apple[11],i,h,ans=0;
        for(int i=1;i<=10;i++)cin>>apple[i];
        cin>>h;
        for(i=1;i<=10;i++)
            if(h+30>=apple[i])ans++;
        cout<<ans<<endl;
        return 0;
    }
    
  • 1
    @ 2020-07-22 11:36:33

    史上最通俗易懂,最暴力的代码:
    #include<iostream>
    using namespace std;
    int main(){
    int l,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,dl,ans;
    cin>>a1>>a2>>a3>>a4>>a5>>a6>>a7>>a8>>a9>>a10;
    cin>>l;
    dl=30;
    l=l+dl;
    if(l>=a1) ans++;
    else ans=ans;
    if(l>=a2) ans++;
    else ans=ans;
    if(l>=a3) ans++;
    else ans=ans;
    if(l>=a4) ans++;
    else ans=ans;
    if(l>=a5) ans++;
    else ans=ans;
    if(l>=a6) ans++;
    else ans=ans;
    if(l>=a7) ans++;
    else ans=ans;
    if(l>=a8) ans++;
    else ans=ans;

    if(l>=a9) ans++;
    else ans=ans;
    if(l>=a10) ans++;
    else ans=ans;
    cout<<ans<<endl;
    return 0;

    }

  • 1
    @ 2020-03-01 11:59:43

    P党题解

    var
      a:array[1..10] of longint;
      i,m,s:longint;
    begin
      for i:=1 to 10 do read(a[i]);
      readln(m);
      for i:=1 to 10 do if m+30>=a[i] then inc(s);
      writeln(s);
    end.
    
  • 1

    很长很长,if套if

    #include<cstdio>
    #include<cmath>
    #include<algorithm>
    #include<cstring>
    #include<iostream>
    using namespace std;
    int main () {
        int a, b, c, d, e, f, g, h, i, j, o, tmp = 0, m;
        scanf("%d %d %d %d %d %d %d %d %d %d\n%d", &a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &o);
        m = o + 30;
        if (100 <= a && a <= 200 && 100 <= o && o <= 120) {
            if (100 <= b && b <= 200) {
                if (100 <= c && c <= 200) {
                    if (100 <= d && d <= 200) {
                        if (100 <= e && e <= 200) {
                            if (100 <= f && f <= 200) {
                                if (100 <= g && g <= 200) {
                                    if (100 <= h && h <= 200) {
                                        if (100 <= i && i <= 200) {
                                            if (100 <= j && j <= 200) {
                                                if (m >= a) tmp++;
                                                if (m >= b) tmp++;
                                                if (m >= c) tmp++;
                                                if (m >= d) tmp++;
                                                if (m >= e) tmp++;
                                                if (m >= f) tmp++;
                                                if (m >= g) tmp++;
                                                if (m >= h) tmp++;
                                                if (m >= i) tmp++;
                                                if (m >= j) tmp++;
                                         } else {
                                                tmp = 0;
                                            }
                                        } else {
                                            tmp = 0;
                                        }
                                    } else {
                                        tmp = 0;
                                    }
                                } else {
                                    tmp = 0;
                                }
                            } else {
                                tmp = 0;
                            }
                        } else {
                            tmp = 0;
                        }
                    } else {
                        tmp = 0;
                    }
                } else {
                    tmp = 0;
                }
            } else {
                tmp = 0;
            }
        } else {
            tmp = 0;
        }
        printf("%d", tmp);
        return 0;
    }
    
  • 1
    @ 2019-05-17 13:22:51

    #include<cstdio>
    #include<iostream>
    using namespace std;

    int a[20];
    int n,m;

    int main()
    {

    for(int i=1;i<=10;i++)
    cin>>a[i];
    cin>>n;

    for(int i=1;i<=10;i++)

    {
    if((n+30)>=a[i])//判断
    m++;
    }
    cout<<m;
    return 0;
    }

  • 1
    @ 2018-10-23 20:26:01

    不用for循环的代码:
    // luogu-judger-enable-o2
    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b,c,d,e,f,g,h,i,j,k,l=0;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k;
    k=k+30;
    if(a<=k)
    {
    l=l+1;
    }
    if(b<=k)
    {
    l=l+1;
    }
    if(c<=k)
    {
    l=l+1;
    }
    if(d<=k)
    {
    l=l+1;
    }
    if(e<=k)
    {
    l=l+1;
    }
    if(f<=k)
    {
    l=l+1;
    }
    if(g<=k)
    {
    l=l+1;
    }
    if(h<=k)
    {
    l=l+1;
    }
    if(i<=k)
    {
    l=l+1;
    }
    if(j<=k)
    {
    l=l+1;
    }
    cout<<l;
    return 0;
    }

  • 1
    @ 2018-08-18 15:10:47

    暴力水过。。。

    
    #include<iostream>
    using namespace std;
    int hi[11];
    int main()
    {
        int n,ans=0;
        for(int i=1;i<=10;i++)
            cin>>hi[i];
        cin>>n;
        n+=30;
        for(int i=1;i<=10;i++)
            if(n>=hi[i])
                ans++;
        cout<<ans;
        return 0;
    }
    
    
  • 1
    @ 2018-05-30 20:34:13

    简单来说就是基础模拟吧

    #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;
    }
    

    代码很简短,希望可以理解

  • 1
    @ 2018-05-19 19:25:12

    #include <iostream>
    #include <algorithm>
    using namespace std;
    int main(int argc, char** argv)
    {
    int pg[11],gd;
    for(int i=1;i<=10;i++)
    {
    cin>>pg[i];
    }
    cin>>gd;
    sort(pg+1,pg+11);
    for(int j=1;j<=10;j++)
    {
    if(pg[j]<=(gd+30))
    {
    continue;
    }
    else
    {
    cout<<j-1;
    break;
    }
    }
    return 0;
    }

  • 1
    @ 2017-08-18 02:48:03
    #include <iostream>
    
    int main() {
        long long a[11],b=0,c=0,n,i;
        for(i=1;i<=10;i++)
        {
            scanf("%lld",&a[i]);
        }
        scanf("%lld",&b);
        for(i=1;i<=10;i++)
        {
            if(a[i]<=b+30)
            c++;
        }
        printf("%lld",c);
        return 0;
    }
    
  • 1
    @ 2017-07-12 17:03:02

    啦啦啦

    #include <cstdio>
    #include <iostream>
    using namespace std;
    int main() {
        int st[10],x,s=0;
        for(int i=1;i<=10;i++){
            cin>>st[i];
        }
        cin>>x;
        for(int i=1;i<=10;i++){
            if(st[i]<=x+30)s++;
        }
        cout<<s;
        return 0;
    }
    
  • 1
    @ 2017-05-08 07:54:17

    乱模拟

    #include <iostream>
    using namespace std;
    
    int a[12];
    int x,ans;
    
    int main()
    {
        for(int i=1;i<=10;i++)
            cin>>a[i];
        cin>>x;
        x+=30;
        for(int i=1;i<=10;i++)
            if(x>=a[i])
                ans++;
        cout<<ans<<endl;
        return 0;
    }
         
    
  • 0
    @ 2023-08-23 14:33:13
    /*****************
    备注:
    *****************/
    #include <iostream>
    #include <iomanip>
    #include <cmath>
    #include <cstring>
    #include <algorithm>
    #include <cstdio>
    #include <set>
    #include <queue>
    #include <bitset>
    #include <deque>
    #include <stack>
    #include <ctime>
    using namespace std;
    #define LL long long
    #define MAXM 3010
    #define MAXN 3010
    const int N =1e5+10;
    const int INF =0x3f3f3f3f;
    int a[11],h,cnt=0; 
    int main ()
    {
        
        for(int i=1;i<=10;i++)
        {
            cin>>a[i];
        }
        cin>>h;
        for(int i=1;i<=10;i++)
        {
            if(a[i]<=h+30)
            {
                cnt++;
            }
        }
            
        cout<<cnt;  
       return 0;
    }
    
  • 0
    @ 2023-06-15 22:12:43

    #include<iostream>
    #include<cmath>
    using namespace std;
    int a[15];
    int main()
    {
    int b,B,A;
    for(int i=1;i<=10;i++)
    cin>>a[i];
    cin>>b;
    B=b+30;
    int c=0;
    for(int i=1;i<=10;i++)
    {
    if(a[i]<=B)

    c++ ;
    }
    cout<<c;
    return 0;
    }

信息

ID
1102
难度
3
分类
模拟 点击显示
标签
递交数
16769
已通过
8813
通过率
53%
被复制
63
上传者