結果
| 問題 | No.478 一般門松列列 |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2017-01-29 12:17:31 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 416 bytes |
| 記録 | |
| コンパイル時間 | 538 ms |
| コンパイル使用メモリ | 71,408 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-29 20:56:04 |
| 合計ジャッジ時間 | 1,990 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
using namespace std;
int n, k;
int a[20171];
int main() {
cin >> n >> k;
a[0] = 114514;
for (int i = 1; i < n - k; i++) {
if (a[i - 1] > 0) {
a[i] = -a[i - 1] + 1;
}
else {
a[i] = -a[i - 1] - 1;
}
}
for (int i = n - k; i < n; i++) {
a[i] = a[i - 1];
}
for (int i = 0; i < n; i++) {
cout << a[i] + 114514;
if (i + 1 < n) cout << " ";
}
cout << endl;
return 0;
}
startcpp