QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#85162#5564. Lots of LandtaniyaWA 3ms3572kbC++23489b2023-03-07 02:01:442023-03-07 02:01:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-07 02:01:45]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3572kb
  • [2023-03-07 02:01:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int n, m, k;

int gcd(int x, int y) {
	if (x < y) swap(x, y);
	if (y == 0) return x;
	return gcd(y, x%y);
}

int main() {
	scanf("%d %d %d\n", &n, &m, &k);
	if ((n*m) % k != 0) {
		printf("IMPOSSIBLE\n");
		return 0;
	}
	int area = (n*m)/k;
	int x = gcd(area, n);
	int y = area / x;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			printf("%c", 'A' + (m/y) * (i/x) + j/y);
		}
		printf("\n");
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3572kb

input:

4 4 4

output:

ABCD
ABCD
ABCD
ABCD

result:

ok correct

Test #2:

score: 0
Accepted
time: 2ms
memory: 3572kb

input:

6 15 9

output:

AAAAABBBBBCCCCC
AAAAABBBBBCCCCC
DDDDDEEEEEFFFFF
DDDDDEEEEEFFFFF
GGGGGHHHHHIIIII
GGGGGHHHHHIIIII

result:

ok correct

Test #3:

score: -100
Wrong Answer
time: 3ms
memory: 3528kb

input:

100 100 26

output:

IMPOSSIBLE

result:

wrong answer Token "IMPOSSIBLE" doesn't correspond to pattern "impossible"