标签:
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { String inLine=""; String flag=""; int miles; String level; int sum=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); while(true){ try{ inLine=br.readLine(); }catch(IOException e){ e.printStackTrace(); } flag=inLine.split(" ")[0]; if(flag.equals("#")){ break; }else if(flag.equals("0")){ System.out.println(sum); sum=0; }else{ miles=Integer.parseInt(inLine.split(" ")[2]); level=inLine.split(" ")[3]; if(level.equals("F")){ sum+=2*miles; }else if(level.equals("B")){ sum+=1.5*miles+0.5; }else if(level.equals("Y")){ if(miles<=500){ sum+=500; }else{ sum+=miles; } } } } } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/eddy_liu/article/details/48089787