< Zeroos

227,208pages on
this wiki
Add New Page
Discuss this page0 Share
  1. include <iostream>
  2. include <cstdio>
  3. include <fstream>

using namespace std;

int suma(int *tab, int n){ int sum = 0;

for(int i=0; i<n; i++){ sum += tab[i]; }

return sum; }

using namespace std; int main(){ ifstream fi;"dane.txt"); int n; fi >> n; int tab[n][n];

for(int x=0; x<n; x++){ for(int y=0; y<n; y++){ fi >> tab[y][x]; } }

for(int x=1; x<n; x++){ for(int y=0; y<n; y++){ for(int i=-1; i<2; i++){ int maks = 0; if(y+i>=0 && y+i<n){ maks = max(tab[x][y] + tab[x-1][y+i], maks); }else continue; tab[x][y] = maks; } } }

for(int x=0; x<n; x++){ for(int y=0; y<n; y++){ cout << tab[x][y] << "\t"; } cout << endl; }

system("pause"); return 0; }

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.