結果
| 問題 |
No.478 一般門松列列
|
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2017-01-29 12:17:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 53,848 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 23:06:55 |
| 合計ジャッジ時間 | 1,662 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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