Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <algorithm>
- #include <iostream>
- #include <vector>
- using namespace std;
- bool cmp(const pair<int, vector <int>>& a, const pair<int, vector < int>>& b){
- return abs(a.first) < abs(b.first);
- }
- int main() {
- vector<pair<int, vector<int>>> c(5, pair<int, vector<int>>(0, vector<int>(5, 0)));
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 5; ++j) {
- scanf("%d", &c[i].second[j]);
- c[i].first += c[i].second[j];
- }
- }
- sort(c.begin(), c.end(),cmp);
- cout << endl;
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 5; ++j) {
- printf("%d ", c[i].second[j]);
- }
- cout << endl;
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement