代入1式可得:Vr = R * C * w * Vs * sqrt(1/(R^2*C^2*w^2 + 1))
#include <stdio.h> #include <math.h> int main(){ double u,r,c,w; int k; scanf("%lf %lf %lf %d",&u,&r,&c,&k); while(k--){ scanf("%lf",&w); printf("%.3lf\n",u*r*c*w*sqrt(1/(1+r*r*c*c*w*w))); } return 0; }
e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoint+273.16)))]
其中有三个参数:humidex,temperature,dewpoint,任意给出其中两个求第三个。
思路:只要给出D求另外两个就是简单套公式,如果求D,那么需要移项写出D的表达式。水题。
#include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <cstdlib> using namespace std; #define clc(s,t) memset(s,t,sizeof(s)) #define INF 0x3fffffff #define E 2.718281828 double s[255]; int main(){ char cmd[10]; double tmp; while(scanf("%s",cmd) && strcmp(cmd, "E")){ s['T'] = s['D'] = s['H'] = 150; scanf("%lf",&tmp); s[cmd[0]] = tmp; scanf("%s %lf",cmd,&tmp); s[cmd[0]] = tmp; tmp = 0.5555*( 6.11*pow(E, 5417.753/273.16*s['D']/(s['D']+273.16)) -10); if(s['H'] == 150){ s['H'] = s['T']+tmp; }else if(s['T'] == 150){ s['T'] = s['H']-tmp; }else{ tmp = log((s['H']-s['T']+5.555)/(0.5555*6.11))/log(E); s['D'] = 273.16*5417.753/(5417.753-tmp*273.16) - 273.16; } printf("T %.1lf D %.1lf H %.1lf\n",s['T'],s['D'],s['H']); } return 0; }