結果
| 問題 |
No.478 一般門松列列
|
| コンテスト | |
| ユーザー |
izryt(趣味)
|
| 提出日時 | 2017-01-28 07:27:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 562 bytes |
| コンパイル時間 | 1,783 ms |
| コンパイル使用メモリ | 165,936 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 20:35:23 |
| 合計ジャッジ時間 | 3,072 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:36: warning: 'idx' may be used uninitialized [-Wmaybe-uninitialized]
28 | cout << ' ' << base+arr[idx];
| ~~~~~~~^
main.cpp:20:9: note: 'idx' was declared here
20 | int idx;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0;i<x;++i)
#define rep1(i,x) for(int i=1;i<=x;++i)
#define fst first
#define scd second
#define int long long
signed main()
{
int n, k; cin >> n >> k;
int arr[] = {1, 0, 2, -1, 0, -2};
int base = 100;
// base+1, base, base+2, base-1, base, base-2, base+1, base
int idx;
rep(i, n-k-2+2) {
if (i) cout << ' ';
cout << base+arr[i%6];
idx = i%6;
}
rep(i, n-(n-k)) {
cout << ' ' << base+arr[idx];
}
cout << endl;
}
izryt(趣味)