結果
| 問題 | No.501 穴と文字列 |
| コンテスト | |
| ユーザー |
rana
|
| 提出日時 | 2021-09-09 21:20:39 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 421 bytes |
| コンパイル時間 | 1,762 ms |
| コンパイル使用メモリ | 28,800 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-31 08:03:59 |
| 合計ジャッジ時間 | 1,512 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <stdio.h>
#include <string.h>
int main(void) {
int i, n, d, sum;
char s[50001];
scanf("%d %d", &n, &d);
sum = 0;
for (i = 0; i < n; ++i) {
if (d == sum) s[i] = 'C';
else if ((n - i - 1) * 2 >= d - sum - 1) {
s[i] = 'A';
++sum;
} else {
s[i] = 'B';
sum += 2;
}
}
s[n] = '\0';
printf("%s\n", s);
}
rana