Lang:G++
Edit12345678910111213141516171819202122232425262728293031#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 )