Need a unique gift idea?
A Pastebin account makes a great Christmas gift


a guest Mar 14th, 2018 62 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. #include <fstream> using namespace std; ifstream fin (""); ofstream fout ("placare.out"); int a[301][301], n, m; int main() { int i, j, x, k; fin >> n >> m; i=j=1; while (i<=n) { if (!a[i][j]) { fin >> x; if (x<0) { x=-x; for (k=0; k<x; k++) a[i+k][j]=x; } else for (k=0; k<x; k++) a[i][j+k]=x; } else { j++; if (j>m) { i++; j=1; } } } for (i=1; i<=n; i++) { for (j=1; j<=m; j++) fout << a[i][j] << " "; fout << "\n"; } return 0; }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand