Cod sursa(job #1128884)
Utilizator | Data | 27 februarie 2014 19:07:33 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.62 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{ ifstream f("tabela.in");
ofstream g("tabela.out");
unsigned long long l,c,max1,max2,i,j;
int v[1000][1000];
f>>l>>c;
v[1][1]=0;
for(i=2;i<=l;i++)
{ v[i][1]=v[i-1][1]+1;
for(j=2;j<=c;j++)
{
v[1][j]=v[1][j-1]+1;
max1=v[i-1][j];
max2=v[i][j-1];
if(max1=max2) v[i][j]=max1-1;
if(max1>max2)v[i][j]=max1+1;
else v[i][j]=max2+1;
}
}
g<<v[l][c];
f.close();
g.close();
return 0;
}