标签:
妈蛋,边听浮夸边撸代码简直醉了,高音飙死我算了,之后找了几个以前喜欢的轻音乐都乱七八糟,妈蛋,(╯‵□′)╯︵┻━┻
1.int main return 0
2.math.h exp() log()
3.while(scanf("%c",&a),a!=‘E‘)
我的思路:
枚举六种情况,六次输出,妈蛋(╯‵□′)╯︵┻━┻一看姐就是有逻辑的人(╯‵□′)╯︵┻━┻
1 #include<stdio.h> 2 #include<math.h> 3 #include<string.h> 4 5 void asd(char x,double xn,char y,double yn) 6 { 7 double e,h,T,D,H; 8 if (x==‘D‘) 9 { 10 e=6.11*exp(5417.7530*((1/273.16)-(1/(xn+273.16)))); 11 h=(0.5555)*(e - 10.0); 12 if (y==‘T‘) {H=yn+h;printf("T %.1lf D %.1lf H %.1lf\n",yn,xn,H);}//tdh 13 else {T=yn-h;printf("T %.1lf D %.1lf H %.1lf\n",T,xn,yn);} 14 } 15 else if (x==‘H‘) 16 { 17 if (y==‘T‘) 18 { 19 h=xn-yn; 20 e=h/(0.5555)+10.0; 21 D=1/(1/273.16-(log(e/6.11))/5417.7530)-273.16; 22 printf("T %.1lf D %.1lf H %.1lf\n",yn,D,xn); 23 } 24 else 25 { 26 e = 6.11*exp (5417.7530 * ((1/273.16) - (1/(yn+273.16)))); 27 h = (0.5555)* (e - 10.0); 28 T=xn-h; 29 printf("T %.1lf D %.1lf H %.1lf\n",T,yn,xn); 30 } 31 } 32 else //x=t 33 { 34 if (y==‘H‘) 35 { 36 h=yn-xn; 37 e=h/(0.5555)+10.0; 38 D=1/(1/273.16-(log(e/6.11))/5417.7530)-273.16; 39 printf("T %.1lf D %.1lf H %.1lf\n",xn,D,yn); 40 } 41 else 42 { 43 e = 6.11 * exp (5417.7530 * ((1/273.16) - (1/(yn+273.16)))); 44 h = (0.5555)* (e - 10.0); 45 H=h+xn; 46 printf("T %.1lf D %.1lf H %.1lf\n",xn,yn,H); 47 } 48 } 49 50 } 51 52 int main() 53 { 54 char a,b; 55 double an,bn; 56 while(scanf("%c",&a),a!=‘E‘){ 57 scanf("%lf %c %lf\n",&an,&b,&bn); 58 asd(a,an,b,bn); 59 }//tdh 60 return 0; 61 }
其他思路:
tdh三变量,读哪个字符存哪个变量里。
判断哪个变量里未被读入就计算该变量的值。比我省了AB&BA这种情况至少一半的工作量(╯‵□′)╯︵┻━┻
代码不上了
标签:
原文地址:http://www.cnblogs.com/travelller/p/4295560.html