11984 - A Change in Thermal Unit

Measuring temperature and temperature differences are common task in many research and applications. Unfortunately, there exists more than one unit of measuring temperatures. This introduces a lot of confusion at times. Two popular units of measurements are Celsius(C) and Fahrenheit (F). The conversion of F from C is given by the formula:

 F=9/5C+32

In this problem, you will be given an initial temperature in C and an increase in temperature in F. You would have to calculate the new temperature in C.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case contains a line with two integers C and d (0 ≤ C, d ≤ 100), where C represents the initial temperature in Celsius and d represents the increase in temperature in Fahrenheit.

Output

For each case, print the case number and the new temperature in Celsius after rounding it to two digits after the decimal point.

Sample Input

Output for Sample Input

2

100 0

0 100

Case 1: 100.00

Case 2: 55.56

 解题思路:应经给定公式但是要注意本题给定以摄氏表示的初始温度C,与以华氏表示的温差F,请你以摄氏温度表示新的温度是多少。公式中的“+32”要忽略

#include<stdio.h>
int main()
{int n,t,c,f;
double d;
scanf("%d",&n);
t=1;
while(n--){
           scanf("%d%d",&c,&f);
           d=c+5*(double)f/9;
           printf("Case %d: %.2f\n",t,d);
           t++;
           }
return 0;
}

 

posted on 2013-02-16 21:19  喂喂还债啦  阅读(253)  评论(0编辑  收藏  举报