1 solutions

  • 0
    @ 2025-11-5 16:39:58

    C :

    #include <stdio.h>
    #include <stdlib.h>
     
    int main()
    {
        int appleh[10], benchh, taoh, bentaoh, i;
        benchh = 30;   
        for (i=0; i<10; i++)   
        {
            scanf("%d", &appleh[i]);
        }
        scanf("%d", &taoh);     
        bentaoh = benchh + taoh;   
        int n = 0;
        for (i=0; i<10; i++)
        {
            if(appleh[i] <= bentaoh)
            {
                n++;  
            }
        }
        printf("%d\n", n);
        return 0;
    }
    

    C++ :

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

    Pascal :

    var
      i,s,n:longint;
      a:array [1..200] of longint;
    begin
      //assign(input,'apple.in');
      //assign(output,'apple.out');
     // reset(input);
     // rewrite(output);
      for i:=1 to 10 do
        read(a[i]);
      s:=0;
      read(n);
      n:=n+30;
      for i:=1 to 10 do
        if a[i]<=n then
        s:=s+1;
      writeln(s);
     // close(input);
     // close(output);
    end.
    

    Java :

    
    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int[] a = new int[10];
    		int b = 30;
    		int sum = 0;
    		for(int i=0;i<10;i++) {
    			a[i] = sc.nextInt();
    		}
    		int n = sc.nextInt();
    		for(int i=0;i<10;i++) {
    			if(n>=a[i]) {
    				sum++;
    			}else if(n+b>=a[i]) {
    				sum++;
    			}
    		}
    		System.out.println(sum);
    		sc.close();
    	}
    
    }
    
    
    • 1

    Information

    ID
    17914
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By