更新至A…
题A
题意:n 组camp,每组若干个人,问多少人参加了全部camp
解:略
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| #include<bits/stdc++.h> using namespace std; map<string,int> p, q; int main(){ int n; cin >> n; set<string> s; for(int j = 1; j <= n; ++ j){ int c; cin >> c; for(int i = 1; i <= c; ++ i) { string x; cin >> x; p[x] ++; s.insert(x); } } for(auto [x, y]: p) if(y == n) q[x] ++; cout << q.size() << '\n'; for(auto [x, y]: q) cout << x << '\n'; }
|