阅读背景:

2017年浙江工业大学大学生程序设计迎新赛热身赛

来源:互联网 

吐槽一下,这套题作为迎新热身好像有点难阿


A

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>
 
using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define lson (rt << 1)
#define rson ((rt << 1) | 1)
#define pill pair<int, int>
#define mst(a, b)   memset(a, b, sizeof a)
#define REP(i, x, n)    for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e6 + 10;
const int INF = 1e9 + 10;
char ans[45];
 
int main(){
    int t;  scanf("%d", &t) ;
    while (t--) {
        int n;  scanf("%d", &n) ;
        double maxn = 0, x, y ;
        char tmp[45];
        for (int i = 1; i <= n; ++i) {
            scanf("%s%lf%lf", tmp, &x, &y) ;
            if (i == 1) {
                strcpy(ans, tmp);
                maxn = x / y;
            } else {
                if(maxn < x * 1.0 / y) {
                    maxn = x / y;
                    strcpy(ans, tmp);
                }
            }
        }
        printf("%s\n", ans);
    }
    return 0;
}#include <cstd



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: