Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- using namespace std;
- int main()
- {
- int data[6][6];
- int n, one, two, three, four;
- for (int i = 1; i <= 5; i++)
- for (n = 1; n <= 5; n++)
- cin >> data[i][n];
- one = data[1][1]+data[1][2]+data[2][3]+data[3][4]+data[4][5];
- two = data[1][1] + data[1][3] + data[3][2] + data[2][4] + data[4][5];
- three = data[1][1] + data[1][3] + data[3][4] + data[4][2] + data[2][5];
- four = data[1][1] + data[1][4] + data[4][3] + data[3][2] + data[2][5];
- if (one <= two&& one <= three && one <= four)
- {
- cout << one << endl;
- cout << "1 2 3 4 5" << endl;
- }
- else
- if (two <= one&& two <= three && two <= four)
- {
- cout << two << endl;
- cout << "1 3 2 4 5" << endl;
- }
- else
- if (three <= one&& three <= two && three <= four)
- {
- cout << three << endl;
- cout << "1 3 4 2 5" << endl;
- }
- else
- {
- cout << four << endl;
- cout << "1 4 3 2 5" << endl;
- }
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment