結果

問題 No.478 一般門松列列
ユーザー HAHAHA
提出日時 2017-01-30 12:24:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 1,462 ms
コンパイル使用メモリ 167,828 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 23:52:40
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:15:25: warning: 'ch' may be used uninitialized [-Wmaybe-uninitialized]
   15 |                 cout << ch;
      |                         ^~
main.cpp:8:14: note: 'ch' was declared here
    8 |         char ch;
      |              ^~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;


int main(){
	int n,k;
	string s ="1324";
	char ch;
	cin >> n >> k;
	for (int i=0; i<n; i++){
		if(i < n-k){
			ch = s[i%4];
		}
		if(i>0) cout << " ";
		cout << ch;
	}
	cout << endl;
	
	return 0;
}
0