elesis's haunt

9498 시험 성적9498 시험 성적 본문

백준~문풀 후 최적화 추가~/단계별로 풀어보기

9498 시험 성적9498 시험 성적

elesis 2021. 4. 14. 23:53
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.close();
        
        if( a >= 90 && a <= 100 ) {
            System.out.print("A");
        } else if ( a >= 80 ) {
            System.out.print("B");
        } else if ( a >= 70 ) {
            System.out.print("C");
        } else if ( a >= 60 ) {
            System.out.print("D");
        } else {
            System.out.print("F");
        }
    }
}
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.close();
        
        switch(a/10) {
            case 10 :
                System.out.print("A");    
            break;
            case 9 :
                System.out.print("A");    
            break;
            case 8 :
                System.out.print("B");    
            break;
            case 7 :
                System.out.print("C");    
            break;
            case 6 :
                System.out.print("D");    
            break;
            default :
                System.out.print("F");
        }
    }
}

 

 

 

속도차이가 막 미라클 하진 않더라...

'백준~문풀 후 최적화 추가~ > 단계별로 풀어보기' 카테고리의 다른 글

14681 사분면 고르기  (0) 2021.04.15
2753 윤년  (0) 2021.04.15
1330 두 수 비교하기  (0) 2021.04.14
2588 곱셈  (0) 2021.04.14
10430 나머지  (0) 2021.04.14
Comments