QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#85162 | #5564. Lots of Land | taniya | WA | 3ms | 3572kb | C++23 | 489b | 2023-03-07 02:01:44 | 2023-03-07 02:01:45 |
Judging History
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");
}
}
详细
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"