CONVERT 오답뜨는 원인을 못 찾겠습니다.

  • chaeheesung
    chaeheesung

    https://algospot.com/judge/submission/detail/234876

    아무리 봐도 잘못된 부분을 찾을 수가 없어서 올려봅니다.

    import java.util.Scanner;

    public class Main {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);

    int count = 1;
    
        int testcase = input.nextInt();
        input.nextLine();
        for(int i=0; i<testcase; i++){
            double inputValues = input.nextDouble();
    
            String eq = input.nextLine();
    
            double result = 0;
    
            if(eq.equals(" kg")){
                result = inputValues * 2.2046;
                String str = String.format("%.4f", result);
                System.out.println(count + " " + str + " lb");
            }else if(eq.equals(" lb")){
                result = inputValues * 0.4536;
                String str = String.format("%.4f", result);
                System.out.println(count + " " + str + " kg");
            }else if(eq.equals(" l")){
                result = inputValues * 0.2642;
                String str = String.format("%.4f", result);
                System.out.println(count + " " + str + " g");
            }else if(eq.equals(" g")){
                result = inputValues * 3.7854;
                String str = String.format("%.4f", result);
                System.out.println(count + " " + result + " l");
            }
            count++;
        }//testcase
    }//main

    }


    9년 전
2개의 댓글이 있습니다.
  • JongMan
    JongMan

    소스코드를 올리실 때는 ~~~ java~~~로 소스코드를 감싸서 구문 강조를 해 주세요.


    9년 전 link
  • JongMan
    JongMan

    오답은

    System.out.println(count + " " + result + " l");
    


    9년 전 link
  • 정회원 권한이 있어야 커멘트를 다실 수 있습니다. 정회원이 되시려면 온라인 저지에서 5문제 이상을 푸시고, 가입 후 7일 이상이 지나셔야 합니다. 현재 문제를 푸셨습니다.