1 条题解

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

    C :

    #include<stdio.h>
    int main(){
    char c;
    int score;
    scanf("%d",&score);
    if(score>=90)
      c='A';
    else if(score>=80&&score<=89)
      c='B';
    else if(score>=70&&score<=79)
      c='C';
    else if(score>=60&&score<=69)
      c='D';
    else if(score<60)
      c='E';
    printf("%c\n",c);
      return 0;
      }
    

    C++ :

    #include <stdio.h>
    int main() {
    	int score;
    	char level;
    	scanf("%d", &score);
    	if (score >= 90)
    		level = 'A';
    	else if (score >= 80)
    		level = 'B';
    	else if (score >= 70)
    		level = 'C';
    	else if (score >= 60)
    		level = 'D';
    	else
    		level = 'E';
    	printf("%c\n", level);
    	return 0;
    }
    
    

    Pascal :

    var n:longint;
    begin
      readln(n);
      if n>=90 then writeln('A')
        else if n>=80 then writeln('B')
          else if n>=70 then writeln('C')
            else if n>= 60 then writeln('D')
             else if n>0 then writeln('E');
    end.    
        
    

    Java :

    import java.util.*;
    public class Main {
    	public static void main(String args[]) {
    		Scanner cin = new Scanner(System.in);
    		char c;
    		int x;
    		x=cin.nextInt();
    		if(x<60)
    			c='E';
    		else if(x<70)
    			c='D';
    		else if(x<80)
    			c='C';
    		else if(x<90)
    			c='B';
    		else
    			c='A';
    		System.out.println(c);
    	}
    }
    

    Python :

    x = input()
    if x >= 90:
      print 'A'
    elif 80 <= x < 90:
      print 'B'
    elif 70 <= x < 80:
      print 'C'
    elif 60 <= x < 70:
      print 'D'
    else:
      print 'E'
    
    • 1

    信息

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