1 条题解
-
0
#include <bits/stdc++.h> using namespace std; int n, m, maxAi; int a[1123456]; int cnt[1123456]; int p[1123456]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] <= m) { cnt[a[i]]++; maxAi = max(maxAi, a[i]); } } for (int i = 1; i <= maxAi; i++) { if (cnt[i] == 0) continue; for (int j = i; j <= m; j += i) p[j] += cnt[i]; } int l = 1; for (int i = 2; i <= m; i++) if (p[i] > p[l]) l = i; cout << l << " " << p[l] << "\n"; for (int i = 1; i <= n; i++) if (l % a[i] == 0) cout << i << " "; return 0; }
- 1
信息
- ID
- 1265
- 时间
- 2000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- 递交数
- 12
- 已通过
- 4
- 上传者