这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。
秉承我个人传统,再水的题目我也要把代码贴出来。。。
HDOJ 2548 两军争锋 题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2548
#include
#include
using namespace std;
double u, v, w, l;
int main()
{
int t;
cin >> t;
while(t--)
{
cin >> u >> v >> w >> l;
cout << setiosflags(ios::fixed) << setprecision(3) << (l/(u+v)*w) << endl;
}
return 0;
}
HDOJ 2561 第二小整数题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2561
#include
#include
using namespace std;
int main ()
{
int val[11];
int T;
cin >> T;
while (T--)
{
int N;
cin >> N;
for (int i=0; i> val[i];
sort (val, val+N);
cout << val[1] << endl;
}
return 0;
}
HDOJ 2562 奇偶位互换 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2562
#include
#include
using namespace std;
char str[55];
int n;
int main()
{
cin >> n;
while(n--)
{
cin >> str;
for(int i=0; i<strlen(str); i+=2)
swap(str[i], str[i+1]);
cout << str << endl;
}
return 0;
}