hihoCoder太阁最新面经算法竞赛12 register

Ended

Participants:164

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-26 17:56:23

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;
#define mod 1000000007
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
typedef long long LL;
typedef unsigned long long ULL;
int a[5];
int x,y;
int s,t;
bool ok(){
    s=a[0]*10+a[1];
    t=a[2]*10+a[3];
    if(s<=23&&t<=59){return 1;}
    return 0;
}
int main(){
    for(int i=0;i<4;i++){
        scanf("%d",a+i);
    }
    x=y=-1;
    sort(a,a+4);
    do{
       if(ok()){
          if((x<s)||(x==s&&y<t)){
            x=s;y=t;
          }
       }
    }while(next_permutation(a,a+4));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX