Created
April 16, 2015 07:32
-
-
Save Baekjoon/d56bb16a1c836c26713f 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]); | |
} | |
for (int l1=0; l1<n; l1++) { | |
for (int l2=0; l2<n; l2++) { | |
if (l1 == l2) continue; | |
for (int l3=0; l3<n; l3++) { | |
if (l1 == l3 || l2 == l3) continue; | |
for (int l4=0; l4<n; l4++) { | |
if (l1 == l4 || l2 == l4 || l3 == l4) continue; | |
for (int l5=0; l5<n; l5++) { | |
if (l1 == l5 || l2 == l5 || l3 == l5 || l4 == l5) continue; | |
for (int l6=0; l6<n; l6++) { | |
if (l1 == l6 || l2 == l6 || l3 == l6 || l4 == l6 || l5 == l6) continue; | |
for (int l7=0; l7<n; l7++) { | |
if (l1 == l7 || l2 == l7 || l3 == l7 || l4 == l7 || l5 == l7 || l6 == l7) continue; | |
if (a[l1]+a[l2]+a[l3]+a[l4]+a[l5]+a[l6]+a[l7] != 100) continue; | |
if (a[l1] <= a[l2] && a[l2] <= a[l3] && a[l3] <= a[l4] && a[l4] <= a[l5] && a[l5] <= a[l6] && a[l6] <= a[l7]) { | |
printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n",a[l1],a[l2],a[l3],a[l4],a[l5],a[l6],a[l7]); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment