1 条题解
-
0
判断是否同时存在:数量大于3的数字和数量大于2的数字
用桶数组计数后,直接排序找最大的两个数量。
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, LL> PII; #define x first #define y second const int N = 5e3 + 10, mod = 1e9 + 7; int cnt[14]; int main() { for(int i = 1; i <= 7; i ++) { int x; cin >> x; cnt[x] ++; } sort(cnt + 1, cnt + 14, greater<int>()); if(cnt[1] >= 3 && cnt[2] >= 2) cout << "Yes\n"; else cout << "No\n"; }
- 1
信息
- ID
- 137
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 20
- 已通过
- 8
- 上传者