hiho week 220 register

Ended

Participants:659

Verdict:Accepted
Score:100 / 100
Submitted:2018-09-17 13:46:45

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
const int maxn=9;
int n;
char ans[2*maxn];
bool flag[maxn];
int rest;
int interrupt;
void dfs(int nowpos){
    if(!rest){
        ans[nowpos]='\0';//, 
        puts(ans);
        return;
    }
    if(nowpos&&ans[nowpos-1]!='-'){//'-' 
        ans[nowpos]='-';
        // 
        int temp=interrupt;
        interrupt=0;
        
        dfs(nowpos+1);
        // 
        interrupt=temp;
    }
    for(int i=interrupt+1;i<=n;i++){
        if(flag[i]){
            ans[nowpos]='0'+i;
            
            // 
            flag[i]=false;
            rest-=1;
            int temp=interrupt;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX