hiho week 207 register

Ended

Participants:91

Verdict:Accepted
Score:100 / 100
Submitted:2018-06-16 20:06:07

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 <bits/stdc++.h>
using namespace std;
int a[4];
int res[24];
int AnsCal( )
{
    int temp[24];
    int i = 0;
    sort(a, a+4);
    res[i] = a[0]*1000+a[1]*100+a[2]*10+a[3];
    while( next_permutation(a, a+4))
    {
        res[++i] = a[0]*1000+a[1]*100+a[2]*10+a[3];
    }
    int k = i, j=0;
    temp[0] = 9999;
    sort(res, res+k);
    for( i=0 ; i<=k ; i++ )
    {
        if( res[i]/100 <= 23 && res[i]%100 <= 59  )
        {
            temp[++j] = res[i];
        }
    }
    return temp[j];
}
int main()
{
    cin>>a[0]>>a[1]>>a[2]>>a[3];
    int ans = AnsCal();
    if( ans<= 2359 )
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX