1. POJ 3299 Humidex
这道题是已知H,D,T三者的运算关系,然后告诉你其中两个。求另一个
#include#include #include #include using namespace std; int main () { char c,h; double T,D,H; while(cin>>c) { T=D=H=1000; if (c=='E') break; if (c=='T') cin>>T; else if (c=='D') cin>>D; else cin>>H;//用这种方式输入比较方便 cin>>h; if (h=='T') cin>>T; else if (h=='D') cin>>D; else cin>>H; if (H==1000) { H=T+0.5555*(6.11*exp (5417.7530 * ((1/273.16) - (1/(D+273.16))))-10.0);//exp(t) 表示e的t次 } if (D==1000) { D=1/(1/273.16-log(((H-T)/0.5555+10.0)/6.11)/5417.7530)-273.16;//log(t) 实际上是lnt } if (T=1000) T=H-0.5555*(6.11*exp (5417.7530 * ((1/273.16) - (1/(D+273.16))))-10.0); printf("T %.1f D %.1f H %.1f\n",T,D,H);//G++上面用.f才AC。 } return 0; }
2. POJ 2159 Ancient Cipher
这道题大致是一串密码,经过字母置换和乱序排序之后得到新的一串加密字符串。然后给出一串加密的和一串专家推测出来的密码。问是否为同一个
这道题其实并不能得到确切的,因为乱序的顺序并没有告诉我们,所以只要判断每个字符出现的次数是否相同即可。
这道题一开始做的时候被坑了,以为重置的就是简单向右移动一位。。
//这道题坑爹之处在于密码置换的时候并不是简单的向左加1.。 而是可以任意替换 #include#include #include #include #include using namespace std; int map[30],b[30]; int main () { int i; char eng[105]; char str[105]; cin>>eng>>str; for (i=0; i