大神求助
查看原帖
大神求助
1593089
ScrPyC楼主2025/1/21 17:06

必关

#include <iostream>
using namespace std;

int f[20000005];

int main() {
    int n, pos;
    cin >> n;
    double a[n];
    int t[n];
    for (int i=0; i<n; ++i)
        cin >> a[i] >> t[i];
    for (int i=0; i<n; ++i)
        for (int j=1; j<=t[i]; ++j) {
            pos = int(j*a[i]);
            f[pos]=f[pos]?0:1;
        }
    for (pos=1;!f[pos];++pos);
    cout << pos << endl;
    return 0;
}

https://www.luogu.com.cn/team/98618

2025/1/21 17:06
加载中...