Cod sursa(job #1426350)
Utilizator | Chihalau Andrei supremus | Data | 29 aprilie 2015 15:41:19 |
---|---|---|---|
Problema | Stramosi | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 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,x,j,k,l;
int t[2000][2000];
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];
l++;j++;
}
}
for(i=1;i<=m;i++)
{
f>>q;f>>p;
g<<t[q][p]<<endl;
}
}