문제접근
•
n이 짝수라면 12가 반복
•
n이 홀수라면 12가 반복되다가 마지막에 3이 들어가면 됨
놓쳤던 부분
코드
2020 KB
0 ms
#include <iostream>
#include <string>
using namespace std;
int main(void) {
	int n;
	int start = 1;
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	while (start <= n) {
		if (start % 2 == 1) {
			if (start == n)
				cout << "3";
			else
				cout << "1 ";
		}
		else
			cout << "2 ";
		start++;
	}
	return (0);
}
C++
복사



