HDACM1302
翻译题,注意点细节就ok
import java.util.Scanner;public class Main{
public static void main(String[] args) {Scanner sc = new Scanner(System.in);while(sc.hasNext()){int h = sc.nextInt();int u = sc.nextInt();int d = sc.nextInt();int f = sc.nextInt();if (h==0) {break;}double sum = u;int day = 1;while (0<=sum && sum<=h) {sum -= d;sum += 1.0*u*(1.0-1.0*f*day/100);day++;if (sum-d<0) {sum -= d;break;}}if (sum>0) {System.out.println("success on day "+day);continue;}System.out.println("failure on day "+day);}}
}