Created
April 16, 2015 07:36
-
-
Save Baekjoon/ef998543e962d6f620a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int main() { | |
int a[9]; | |
int n=9; | |
for (int i=0; i<n; i++) { | |
scanf("%d",&a[i]); | |
} | |
int l[9]; | |
for (l[0]=0; l[0]<n; l[0]++) { | |
for (l[1]=0; l[1]<n; l[1]++) { | |
for (l[2]=0; l[2]<n; l[2]++) { | |
for (l[3]=0; l[3]<n; l[3]++) { | |
for (l[4]=0; l[4]<n; l[4]++) { | |
for (l[5]=0; l[5]<n; l[5]++) { | |
for (l[6]=0; l[6]<n; l[6]++) { | |
bool ok = true; | |
for (int i=0; i<7; i++) { | |
for (int j=i+1; j<7; j++) { | |
if (l[i] == l[j]) { | |
ok = false; | |
} | |
} | |
} | |
if (!ok) continue; | |
int sum = 0; | |
for (int i=0; i<7; i++) { | |
sum += a[l[i]]; | |
} | |
if (sum != 100) continue; | |
for (int i=0; i<6; i++) { | |
if (a[l[i]] > a[l[i+1]]) { | |
ok = false; | |
} | |
} | |
if (!ok) continue; | |
for (int i=0; i<7; i++) { | |
printf("%d\n",a[l[i]]); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment