Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- using namespace std;
- int main()
- {
- ifstream input("C:\\Users\\Максим\\Downloads\\28130_A (1).txt");
- int n = 0, now = 0;
- vector<pair<int, int>> v(80); //pair: >50; <=50
- input >> n;
- for (size_t i = 0; i < n; i++)
- {
- input >> now;
- if (now > 50) {
- int k = now % 80;
- v[now % 80].first++;
- }
- else {
- v[now % 80].second++;
- }
- }
- int res = ((v[0].first - 1) * v[0].first) / 2;
- for (size_t i = 1; i < 40; i++)
- {
- res += v[i].first * v[80 - i].second + v[i].first * v[80 - i].first
- + v[i].second * v[80 - i].first;
- }
- res += v[40].first * v[40].second + ((v[40].first - 1) * v[40].first) / 2;
- cout << res;
- }
- /*https://inf-ege.sdamgia.ru/problem?id=28130*/
Advertisement
Add Comment
Please, Sign In to add comment