题解

459 条题解

  • 0
    @ 2018-11-04 17:34:13

    #include <iostream>
    #include <queue>
    using namespace std;
    priority_queue<int>apple;
    int main()
    {
    int i,tao,ap;
    for(i=1;i<=10;i++)
    {
    cin>>ap;
    apple.push(ap);
    }
    cin>>tao;
    tao+=30;
    for(i=1;i<=10;i++)
    {
    ap=apple.top();
    if(tao>=ap)
    break;
    apple.pop();
    }
    cout<<11-i<<endl;
    system("Pause");
    return 0;
    }

  • 0
    @ 2018-11-03 20:07:19

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    int n,ans=0,a[11];
    for(int i=1;i<=10;i++) scanf("%d",&a[i]);
    scanf("%d",&n);
    for(int i=1;i<=10;i++)
    if(n+30>=a[i]) ans++;
    printf("%d",ans);
    return 0;
    }

  • 0
    @ 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;
    }

  • 0
    @ 2018-10-23 11:00:29

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

    ans++;
    }
    cout<<ans<<endl;
    return 0;
    }

  • 0
    @ 2018-10-19 19:51:43

    #include<stdio.h>

    int main(void)
    {
    int n = 0, max_len = 0;
    int apple_len[10];

    for (int i = 0; i < 10; i++)
    scanf("%d", &apple_len[i]);

    scanf("%d", &max_len);
    for (int i = 0; i < 10; i++)
    {
    if (max_len >= apple_len[i] || max_len + 30 >= apple_len[i])
    n++;
    }
    printf("%d", n);
    return 0;
    }

  • 0
    @ 2018-10-09 13:21:17

    #include<cstdio>
    using namespace std;
    int main()
    {
    int a[10],k,b=0;
    for(int i=0;i<10;i++){
    scanf("%d",&a[i]);
    }
    scanf("%d",&k);
    for(int i=0;i<10;i++)
    {
    if(a[i]-30<=k){
    b+=1;
    }
    }
    printf("%d",b);
    }

  • 0
    @ 2018-08-26 12:41:43

    var
    a:array[1..10]of longint;
    i,j,k,taotao:integer;
    Begin
    for i:= 1 to 10 do
    begin
    read(a[i]);
    end;
    readln(k);
    j:=k+30;
    i:=1;
    for i:= 1 to 10 do
    begin
    if(a[i] <= j) then taotao:=taotao+1;
    end;
    writeln(taotao);
    End.
    求指点代码还可以简化吗?

  • 0
    @ 2018-08-18 17:44:19

    这是一道很简单的模拟题,一个循环即可。

    #include<cstdio>
    #include<iostream>
    using namespace std;
    int a[11],ans,x;
    int main(){
        for(int i=1;i<=10;i++){
            cin>>a[i];
        }
        cin>>x;
        x=x+30;
        for(int i=1;i<=10;i++){
            if(a[i]<=x) ans++;
        }
        cout<<ans;
        return 0;
    }
    
  • 0
    @ 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;
    }
    
    
  • 0
    @ 2018-07-24 13:03:13

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

    }

  • 0
    @ 2018-07-22 12:35:44

    C++标程:
    #include <iostream>
    using namespace std;
    int a[15];
    int main()
    {
    int n,count=0;//count为累加器
    for (int i=1;i<=10;i++)
    cin>>a[i];//输入10个苹果🍎离地面的高度
    cin>>n;//陶陶伸手最大高度
    n+=30;//在加上板凳的高度,求出陶陶摘苹果最高的高度
    for (int i=1;i<=10;i++)
    if (n>=a[i]) count++;//如果够得到,就加1
    cout<<count<<endl;
    return 0;
    }

  • 0
    @ 2018-06-21 15:02:48

    height_of_apple = input(" ")
    arm_height = input(" ")
    arm_height = int(arm_height)
    height_of_apple = height_of_apple.split()
    e = list()
    for c in height_of_apple:
    c = int(c)
    if arm_height >= c or arm_height + 30 >= c:
    e.append(c)
    print(len(e))

  • 0
    @ 2018-06-21 15:02:30

    height_of_apple = input(" ")
    arm_height = input(" ")
    arm_height = int(arm_height)
    height_of_apple = height_of_apple.split()
    e = list()
    for c in height_of_apple:
    c = int(c)
    if arm_height >= c or arm_height + 30 >= c:
    e.append(c)
    print(len(e))

  • 0
    @ 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;
    }
    

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

  • 0
    @ 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;
    }

  • 0
    @ 2018-04-30 21:41:26

    using System;
    using System.Linq;

    namespace ConsoleApplication6
    {
    class Program
    {
    static void Main(string[] args)
    {
    string str1 = Console.ReadLine();
    string str2 = Console.ReadLine();
    string[] strnumLlist = str1.Split(' ');

    Console.WriteLine((from s in strnumLlist
    where int.Parse(s) <= int.Parse(str2) + 30
    select int.Parse(s)).Count());
    }
    }
    }

  • 0
    @ 2018-04-30 21:41:02

    using System;
    using System.Linq;

    namespace ConsoleApplication6
    {
    class Program
    {
    static void Main(string[] args)
    {
    string str1 = Console.ReadLine();
    string str2 = Console.ReadLine();
    string[] strnumLlist = str1.Split(' ');

    Console.WriteLine((from s in strnumLlist
    where int.Parse(s) <= int.Parse(str2) + 30
    select int.Parse(s)).Count());
    }
    }
    }

  • 0
    @ 2018-03-10 10:54:10

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

  • 0
    @ 2018-02-13 14:54:20

    #include<iostream>
    using namespace std;
    int main()
    {
    int a[22],b,c,num=0,e[33],i,t;
    for (int i=0;i<10;i++)
    {
    cin>>a[i];
    }
    cin>>b;
    for(i=0;i<10;i++)
    {
    e[i]=a[i];
    if(e[i]<=b+30) num+=1;
    }
    cout<<num;
    return 0;
    }

  • 0
    @ 2018-02-03 10:34:11

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

信息

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