WA

2j1ejyu Reply 6 years 2 weeks ago
왜 틀리다고 뜰까요... import java.util.Arrays; import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); double c = input.nextDouble(); input.nextLine(); while(c!=0){ System.out.print(cardnum(c)+" card(s)"); c= input.nextDouble(); if(c!=0) input.nextLine(); System.out.println(); } System.out.printf("\b"); } public static int cardnum(double c){ double sum = 0; int n=0; while(sum<c){ n++; sum += (double)1/(1+n); } return n; } }
Hyunwoo Reply 6 years 1 week ago
축하합니다.