Cod sursa(job #1378023)

Utilizator supremusChihalau Andrei supremus Data 6 martie 2015 10:09:43
Problema Stramosi Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("stramosi.in");
ofstream g("stramosi.out");
using namespace std;

int n,m,i,q,p,t[250000][300000],x,j,k,l;
int main()
{
    f>>n;
    f>>m;
    for(i=1;i<=n;i++)
      {   f>>x;
        j=1;
        t[i][j]=x;
        k=i;
        l=1;
        while(k-l!=-1)
        {
            t[k][j+1]=t[k-l][j];
            cout<<t[k][j+1]<<" ";
            l++;j++;

        }
      }
      cout<<endl;
    for(i=1;i<=m;i++)
    {

        f>>q;f>>p;
       g<<t[q][p]<<endl;
    }
}