QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21252#5. 在线 O(1) 逆元FudanU1Compile Error//C++1.6kb2022-03-04 13:49:352024-11-05 21:46:28

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 21:46:28]
  • 管理员手动重测本题所有提交记录
  • [2024-11-05 21:43:01]
  • 管理员手动重测本题所有提交记录
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-18 04:11:06]
  • 评测
  • [2022-03-04 13:49:35]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, r, l) for (int i = r; i >= l; i--)
#define srep(i, l, r) for (int i = l; i < r; i++)
#define sper(i, r, l) for (int i = r; i > l; i--)
#define maxn 2020
using namespace std;

char out[maxn][maxn];

void plot_diag(int x, int y, char c1, char c2){
	while (x >= 0) {
		out[x][y] = c1;
		x--, y--;
		out[x][y] = c2;
		x--, y--;
	}
}

void plot_diag(int x, int y, char c1, char c2, int rest){
	while (rest) {
		out[x][y] = c1;
		x--, y--;
		out[x][y] = c2;
		x--, y--;
		
		rest--;
	}
}

void work(int a, int b, int c) {
	rep(j, 0, 2 * a + 2 * b){
		rep(i, 0, 2 * b + 2 * c){
			out[i][j] = '.';
		}
	}
	
	int _rest = a, x, y, _y, rest;
	
	y = 0;
	while (_rest){
		x = 2 * b, rest = c;
		while (rest){
			out[x][y] = '+';
			out[x + 1][y] = '|';
			x += 2;
			rest--;
		}
		out[x][y] = '+', y++;
		plot_diag(2 * b - 1, y, '/', '+');
		
		x = 2 * b, rest = c;
		while (rest){
			out[x][y] = '-';
			x += 2;
			rest--;
		}
		out[x][y] = '-', y++;
		plot_diag(2 * b - 1, y, '.', '-');
		
		_rest--;
	}	
	
	x = 2 * b, rest = c;
	while (rest){
		out[x][y] = '+';
		plot_diag(x - 1, y + 1, '/', '+', b);
		out[x + 1][y] = '|';
		plot_diag(x, y + 1, '.', '|', b);
		x += 2;
		rest--;
	}
	out[x][y] = '+', y++;
	plot_diag(x - 1, y + 1, '/', '+', b);
	
	
	rep(j, 0, 2 * a + 2 * b){
		rep(i, 0, 2 * b + 2 * c){
			printf("%c", out[i][j]);
		}
		printf("\n");
	}
}

int main(){
	int T, a, b, c; cin >> T;
	while (T--){
		cin >> a >> b >> c;
		work(a, b, c);
	}
	return 0;
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccTm4kWe.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwIDHbd.o:implementer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccwIDHbd.o: in function `main':
implementer.cpp:(.text.startup+0x12b): undefined reference to `init(int)'
/usr/bin/ld: implementer.cpp:(.text.startup+0x1d0): undefined reference to `inv(int)'
collect2: error: ld returned 1 exit status