编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#47200 #1022. jwp的排队难题 Compile Error 0 0 ms 0 K C++ / 559 B 计试001陈子鹏 2021-03-04 9:09:06
显示原始代码
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL LINF = 0x3f3f3f3f3f3f3f3f;

struct node {
    int a, b;
} tour[100050];

bool cmp(const node &t1, const node &t2) { return t1.a * t2.b > t1.b * t2.a; }

int n, tim;
LL ans;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d%d", &tour[i].a, &tour[i].b);
    }
    sort(tour, tour + n, cmp);
    for (int i = 0; i < n; i++) {
        tim += tour[i].b;
        ans += tim * tour[i].a;
    }
    cout << ans;
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:24:3: error: 'scanf' was not declared in this scope
   scanf("%d%d", &tour[i].a, &tour[i].b);
   ^~~~~
/sandbox/1/a.cpp:24:3: note: suggested alternative: 'wscanf'
   scanf("%d%d", &tour[i].a, &tour[i].b);
   ^~~~~
   wscanf