andy6804tw
10/2/2016 - 4:43 AM

http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=6922 這題跟計算停車費類似

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner (System.in);
		while(scn.hasNext()){
			int time=scn.nextInt(),salary=scn.nextInt();
			double tot=0;
			if(time<=60){
				tot=time*salary;
			}
			else if(time>60&&time<=120){
				tot=60*salary+time*(time-60)*1.33;
			}
			else
				tot=salary*60+salary*60*1.33+(time-120)*salary*1.66;
			System.out.printf("%.1f\n",tot);
		}

	}
	/* 
    題目:Q11494:  Queen
    作者:1010
    時間:西元 2016 年 10 月 */

}