102


SUBMITTED BY: Guest

DATE: Dec. 25, 2013, 3:01 p.m.

FORMAT: Text only

SIZE: 1.3 kB

HITS: 2013

  1. #include <cstdio>
  2. int main()
  3. {
  4. // b, g, c
  5. int first [3];
  6. int second[3];
  7. int third [3];
  8. while ( scanf("%d %d %d %d %d %d %d %d %d", &first[0], &first[1], &first[2], &second[0], &second[1], &second[2], &third[0], &third[1], &third[2]) == 9 )
  9. {
  10. int gbc = first[0]+first[2]+second[1]+second[2]+third[0]+third[1];
  11. int gcb = first[0]+first[2]+second[0]+second[1]+third[1]+third[2];
  12. int bgc = first[1]+first[2]+second[0]+second[2]+third[0]+third[1];
  13. int bcg = first[1]+first[2]+second[0]+second[1]+third[0]+third[2];
  14. int cgb = first[0]+first[1]+second[0]+second[2]+third[1]+third[2];
  15. int cbg = first[0]+first[1]+second[1]+second[2]+third[0]+third[2];
  16. int min = gbc;
  17. if ( min > gcb )
  18. min = gcb;
  19. if ( min > bgc )
  20. min = bgc;
  21. if ( min > bcg )
  22. min = bcg;
  23. if ( min > cgb )
  24. min = cgb;
  25. if ( min > cbg )
  26. min = cbg;
  27. if ( min == bcg )
  28. printf("BCG %d\n", min);
  29. else if ( min == bgc )
  30. printf("BGC %d\n", min);
  31. else if ( min == cbg )
  32. printf("CBG %d\n", min);
  33. else if ( min == cgb )
  34. printf("CGB %d\n", min);
  35. else if ( min == gbc )
  36. printf("GBC %d\n", min);
  37. else if ( min == gcb )
  38. printf("GCB %d\n", min);
  39. }
  40. return 0;
  41. }

comments powered by Disqus