Codeforces Round #444 (Div. 2), problem: (B) Cubes for Masha Solution In C/C++

#include<stdio.h>
int main()
{
int n,i,j,k,m,A[10][10],B[1000];
scanf(“%d”,&n);
for(i=1;i<=n;i++){
for(j=1;j<=6;j++){
scanf(“%d”,&A[i][j]);}
}
for(i=1;i<=100;i++){
B[i]=0;}
for(i=1;i<=n;i++){
for(j=1;j<=6;j++){
B[A[i][j]]=1;
for(k=1;k<=n;k++){
for(m=1;m<=6;m++){
if (k!=i){
B[A[i][j]*10+A[k][m]]=1;
}
}
}
}
}
i=1;
while(B[i]){
i++;}
printf(“%d”,i-1);
return 0;
}

(Visited 62 times, 1 visits today)

About the Author:

Leave A Comment