← Back to List

11866번: 요세푸스 문제 0 ↗

Solutions

C++14
324 B | 324 chars
#include <iostream>
#include <queue>
using namespace std;
queue <int> q;
int A,B;
int main()
{
	cin>>A>>B;
	for(int x=1; x<=A; x++) q.push(x);
	cout<<"<";
	while(!q.empty())
	{
		for(int x=1; x<B; x++)
		{
			q.push(q.front());
			q.pop();
		}
		cout<<q.front();
		q.pop();
		if(q.size()>0)cout<<", ";
		else cout<<">";
	}
}