Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #include <bitset>
- #include <iostream>
- #include <stack>
- #include <queue>
- #include <set>
- #include <map>
- #include <string>
- #include <algorithm>
- using namespace std;
- int n, r, c, m, w;
- bool u[110][110];
- int main() {
- freopen("class.in", "r", stdin);
- freopen("class.out", "w", stdout);
- scanf("%d%d%d", &n, &r, &c);
- m = min(r, c);
- if (2 * m - 1 <= n)
- w = m;
- else
- w = (n - 1) / 2 + 1;
- printf("%d\n", w);
- for (int j = 0; j < w; j++) {
- u[0][j] = 1;
- n--;
- }
- for (int i = 1; i < w; i++) {
- u[i][0] = 1;
- n--;
- }
- for (int i = 0; i < r; i++) {
- for (int j = 0; j < c; j++) {
- if (u[i][j] || !n)
- continue;
- u[i][j] = 1;
- n--;
- }
- }
- for (int i = 0; i < r; i++) {
- for (int j = 0; j < c; j++)
- printf("%c", u[i][j] ? '#' : '.');
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement