daily pastebin goal


a guest Mar 14th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <fstream> using namespace std; ifstream fin ("placare.in"); 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