hiho week 207 register

Ended

Participants:91

Verdict:Accepted
Score:100 / 100
Submitted:2018-06-22 01:46:43

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
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm> 
using namespace std;
int main()
{
    int a[4];
    int b[4];
    bool has_result;
    while(scanf("%d%d%d%d", a+0, a+1, a+2, a+3)== 4)
    {
        has_result = false;
        sort(a, a+4);
        do
        {
            if((a[0]==2 && a[1]<4 || a[0]<2) && a[2]<6)
            {
                has_result = true;
                memcpy(b, a, sizeof(a));
            }
        }
        while(next_permutation(a, a+4));
        if(has_result)
            printf("%d%d:%d%d\n", b[0], b[1], b[2], b[3]);
        else printf("NOT POSSIBLE\n");
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX