1.若下标不为整数可以直接带入int自动取整
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int a[2000005] = { 0 };
int main() {
int n; cin >> n;
double ai; int t;
int k;
for (int i = 0; i < n; i++) {
cin >> ai >> t;
for (int j = 1; j <= t; j++) {
int k = ai * j;
a[k] = 1 - a[k];
}
}
for (int i = 1; i < 2000000; i++) {
if (a[i] == 1) {
cout << i << endl;
return 0;
}
}
return 0;
}