Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <thread>
- using namespace std;
- void count_dividers(list<int> List) {
- int sum = 0, count = 0;
- for (auto it = List.begin(); it != List.end(); it++) {
- sum += *it;
- }
- for (auto it = List.begin(); it != List.end(); it++) {
- if (sum % *it == 0) {
- count++;
- }
- }
- cout << count << endl;
- }
- int main() {
- list<int> mylist;
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int temp;
- cin >> temp;
- mylist.push_back(temp);
- }
- thread aboba([=] {
- count_dividers(mylist);
- });
- aboba.join();
- aboba.detach();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement