1 条题解

  • 0
    @ 2025-4-7 21:28:46

    C :

    #include<stdio.h>
    int main(){
    int i;
    int cred[50],score[50];
      for(i=0;i<50;i++){
        scanf("%d %d",&cred[i],&score[i]);}
      for(i=0;i<50;i++){
        if(score[i]>=80)
          printf("%d %d\n",cred[i],score[i]);}
    }
    

    C++ :

    #include <stdio.h>
    int main() {
    	int n, score, i;
    	for (i = 1;i <= 50;i++) {
    		scanf("%d %d", &n, &score);
    		if (score >= 80)
    			printf("%d %d\n", n, score);
    	}
    	return 0;
    }
    
    

    Pascal :

    var
      a,b:array[1..50] of longint;
      i:longint;
    begin
      for i:=1 to 50 do
      readln(a[i],b[i]);
      for i:=1 to 50 do
      if (b[i]>=80) then writeln(a[i],' ',b[i]);
    end.
    

    Java :

    import java.util.Scanner;
    public class Main {
    	public static void main(String[] args) {
    		int n=50;
    		Scanner s=new Scanner(System.in);
    		while(n--!=0&&s.hasNext()){
    			int a[]=new int [2];
    			a[0]=s.nextInt();
    			a[1]=s.nextInt();
    			if(a[1]>=80){
    				System.out.print(a[0]+" ");
    				System.out.print(a[1]);
                  System.out.println();
    			}
    		}
    	}
    }
    
    

    Python :

    import sys
    for line in sys.stdin:
      if int(line.split()[1]) >= 80:
        print line.rstrip('\n')
    

    C# :

    using System;
    
    namespace C言语
    {
        class _2_2
        {      
            public static void Main()
            {
                for (int i = 0; i < 50; i++)
                {
                    string[] str = Console.ReadLine().Split(' ');
                    if(Convert.ToInt32(str[1])>=80) 
                    {
                        Console.WriteLine(str[0]+' '+str[1]);
                    }
                }
                Console.ReadLine();
                return;
            }
        }
    }
    
    
    • 1

    信息

    ID
    1219
    时间
    1000ms
    内存
    32MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者