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

By |2017-11-07T20:00:13+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#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; }