倒数第二小的数
題目:HDOJ 2561
#include <iostream> #include <cstdio> #include <cmath> #include <iomanip> #include <algorithm> #include <vector> #include <map> #include <string> #include <sstream> #include <cstring>using namespace std;//const double E = 2.71828182845904523536; //const double PI= 3.14159265359int main(){int C;cin >> C;while(C--){int n;cin >> n;int h[2]= {101,101};int max= 0;int t;while(n--){cin >> t; if(t< h[0] || t< h[1]){h[max]= t;max= (h[0]>h[1])?0:1;}}t= (h[0]>h[1])?h[0]:h[1];cout << t << endl;}return 0; }?
轉載于:https://www.cnblogs.com/miaoz/p/4183811.html
總結
- 上一篇: 决胜大数据时代:HadoopYarnSp
- 下一篇: 开发中坑爹的地方