QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#574274 | #5564. Lots of Land | V-ioleT | WA | 0ms | 3580kb | C++20 | 1.4kb | 2024-09-18 21:21:13 | 2024-09-18 21:21:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define ull unsigned long long
typedef long long ll;
#define lowbit(x) ((x) & -(x))
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 1e5 + 5, M = 1e5 + 10;
typedef pair<int, int> PII;
double T = 1 >> 30;
// double PI = acos(-1);
int gcd(int a, int b)
{
return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b)
{
return a / gcd(a, b) * b;
}
void solve()
{
int i, j;
int n, m, k;
cin >> n >> m >> k;
if ((n * m) % k != 0)
{
cout << "IMPOSSIBLE";
return;
}
int s = n * m / k;
for (int x = 1; x <= s; x++)
{
if (s % x != 0)
continue;
int y = s / x;
if (n % x || m % y)
continue;
int t = m / y;
for (i = 0; i < n;i++)
{
for (j = 0; j < m;j++)
{
cout << (char)('A' + (i / x) * t + (j / y));
}
cout << endl;
}
return;
}
cout << "IMPOSSIBLE";
}
signed main()
{
// ios_base::sync_with_stdio(false);
// cin.tie(nullptr);
// cout.tie(nullptr);
int t = 1;
// cin >> t;
while (t--)
{
// Case++;
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
input:
4 4 4
output:
AAAA BBBB CCCC DDDD
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
6 15 9
output:
AAAAABBBBBCCCCC AAAAABBBBBCCCCC DDDDDEEEEEFFFFF DDDDDEEEEEFFFFF GGGGGHHHHHIIIII GGGGGHHHHHIIIII
result:
ok correct
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
100 100 26
output:
IMPOSSIBLE
result:
wrong answer Token "IMPOSSIBLE" doesn't correspond to pattern "impossible"