d051: 糟糕,我發燒了!

題目:http://zerojudge.tw/ShowProblem?problemid=d051
程式碼:

import java.util.Scanner;
public class d051 {

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);
  while(sc.hasNext()){
   double f = sc.nextDouble();//用double避免誤差
   double r = (f - 32) * 5 / 9;
   System.out.printf("%.3f\n",r);
  }

 }

}

留言

熱門文章