---
layout: post
title:  "[BOJ] 10972. 다음 순열"
categories: Algorithm
tags: BOJ 
author: goodGid
---
* content
{:toc}

## Problem

Problem URL : **[다음 순열](https://www.acmicpc.net/problem/10972)**












![](/assets/img/algorithm/10972_1.png)

![](/assets/img/algorithm/10972_2.png)

![](/assets/img/algorithm/10972_3.png)

---


## [1] Answer Code (18. 09. 24)

``` cpp
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int n;
    cin >> n;
    
    vector<int> v;
    while (n--) {
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    
    if( next_permutation(v.begin(),v.end()) ){
        for(int i=0; i<v.size(); i++)
            cout << v[i] << " ";
    }
    else{
        cout << "-1" << endl;
    }
    
    return 0;
}
```

### Review

* 정리해 놓은 [순열]({{site.url}}/Permutation/) 글을 읽어보자.
Write BOJ Post " 10972. 다음 순열 "
Write BOJ Post " 10972. 다음 순열 "
