Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int i = 1, dx=0, dy=0;
- vector <vector <int> > mas = {{0,0,0,0,0,0,},{0,1,0,1,0,1},{0,1,0,1,0,1},{0,1,0,1,0,1},{0,1,0,1,0,1},{0,1,0,1,0,1}};
- while (i<=5) {
- int j = 1;
- while (j<=5) {
- if (mas[i][j]==1) {
- if (i<j) {
- dx+=i;
- dy-=j;
- } else if (i>j) {
- dx-=i;
- dy+=i;
- }
- } j++;
- } i++;
- } cout << dx << " " << dy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement