// テトロミノ認識〜 横へな 2012.10.6
// http://n...content-available-to-author-only...e.jp/hena/ord4tetroid/
// に対する答案。
using System;
using System.Collections .Generic ;
using System.Text ;
namespace ord4tetroid
{
static class Program
{
static string[ ] L = { "00011121" , "00010210" , "00102021" , "02101112" , "01112021" , "00010212" , "00011020" , "00101112" } ;
static string[ ] I = { "00010203" , "00102030" , } ;
static string[ ] T = { "00101120" , "01101112" , "01101121" , "00010211" , } ;
static string[ ] O = { "00011011" , } ;
static string[ ] S = { "00011112" , "01101120" , "01021011" , "00101121" , } ;
static string solve( string points)
{
int [ ] array = Array.ConvertAll ( points.Split ( ',' ) , int .Parse ) ;
Array.Sort ( array) ;
// 左上に寄せる
while ( Array.TrueForAll ( array, i => i % 10 >= 1 ) ) array = Array.ConvertAll ( array, i => i - 1 ) ;
while ( Array.TrueForAll ( array, i => i >= 10 ) ) array = Array.ConvertAll ( array, i => i - 10 ) ;
string inputStr = string.Join ( "" , Array.ConvertAll ( array, i => i.ToString ( "00" ) ) ) ;
if ( Array.IndexOf ( L, inputStr) != - 1 ) return "L" ;
if ( Array.IndexOf ( I, inputStr) != - 1 ) return "I" ;
if ( Array.IndexOf ( T, inputStr) != - 1 ) return "T" ;
if ( Array.IndexOf ( O, inputStr) != - 1 ) return "O" ;
if ( Array.IndexOf ( S, inputStr) != - 1 ) return "S" ;
return "-" ;
}
static void test( string input, string expected)
{
string result = solve( input) ;
Console.WriteLine ( "input: {0} expected: {1} received: {2} Judge: {3}" , input, expected, result, ( expected == result ? "OK" : "NG" ) ) ;
if ( result != expected) throw new ApplicationException( ) ;
}
static void Main( )
{
/*#1*/ test( "55,55,55,55" , "-" ) ;
/*#2*/ test( "07,17,06,05" , "L" ) ;
/*#3*/ test( "21,41,31,40" , "L" ) ;
/*#4*/ test( "62,74,73,72" , "L" ) ;
/*#5*/ test( "84,94,74,75" , "L" ) ;
/*#6*/ test( "48,49,57,47" , "L" ) ;
/*#7*/ test( "69,89,79,68" , "L" ) ;
/*#8*/ test( "90,82,91,92" , "L" ) ;
/*#9*/ test( "13,23,03,24" , "L" ) ;
/*#10*/ test( "24,22,25,23" , "I" ) ;
/*#11*/ test( "51,41,21,31" , "I" ) ;
/*#12*/ test( "64,63,62,65" , "I" ) ;
/*#13*/ test( "49,69,59,79" , "I" ) ;
/*#14*/ test( "12,10,21,11" , "T" ) ;
/*#15*/ test( "89,99,79,88" , "T" ) ;
/*#16*/ test( "32,41,43,42" , "T" ) ;
/*#17*/ test( "27,16,36,26" , "T" ) ;
/*#18*/ test( "68,57,58,67" , "O" ) ;
/*#19*/ test( "72,62,61,71" , "O" ) ;
/*#20*/ test( "25,24,15,14" , "O" ) ;
/*#21*/ test( "43,54,53,42" , "S" ) ;
/*#22*/ test( "95,86,76,85" , "S" ) ;
/*#23*/ test( "72,73,84,83" , "S" ) ;
/*#24*/ test( "42,33,32,23" , "S" ) ;
/*#25*/ test( "66,57,67,58" , "S" ) ;
/*#26*/ test( "63,73,52,62" , "S" ) ;
/*#27*/ test( "76,68,77,67" , "S" ) ;
/*#28*/ test( "12,11,22,01" , "S" ) ;
/*#29*/ test( "05,26,06,25" , "-" ) ;
/*#30*/ test( "03,11,13,01" , "-" ) ;
/*#31*/ test( "11,20,00,21" , "-" ) ;
/*#32*/ test( "84,95,94,86" , "-" ) ;
/*#33*/ test( "36,56,45,35" , "-" ) ;
/*#34*/ test( "41,33,32,43" , "-" ) ;
/*#35*/ test( "75,94,84,95" , "-" ) ;
/*#36*/ test( "27,39,28,37" , "-" ) ;
/*#37*/ test( "45,34,54,35" , "-" ) ;
/*#38*/ test( "24,36,35,26" , "-" ) ;
/*#39*/ test( "27,27,27,27" , "-" ) ;
/*#40*/ test( "55,44,44,45" , "-" ) ;
/*#41*/ test( "70,73,71,71" , "-" ) ;
/*#42*/ test( "67,37,47,47" , "-" ) ;
/*#43*/ test( "43,45,41,42" , "-" ) ;
/*#44*/ test( "87,57,97,67" , "-" ) ;
/*#45*/ test( "49,45,46,48" , "-" ) ;
/*#46*/ test( "63,63,52,72" , "-" ) ;
/*#47*/ test( "84,86,84,95" , "-" ) ;
/*#48*/ test( "61,60,62,73" , "-" ) ;
/*#49*/ test( "59,79,69,48" , "-" ) ;
/*#50*/ test( "55,57,77,75" , "-" ) ;
}
}
}
Ly8g44OG44OI44Ot44Of44OO6KqN6K2Y44CcIOaoquOBuOOBqiAyMDEyLjEwLjYKLy8gaHR0cDovL24uLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmUuanAvaGVuYS9vcmQ0dGV0cm9pZC8KCi8vIOOBq+WvvuOBmeOCi+etlOahiOOAggoKdXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLlRleHQ7CgpuYW1lc3BhY2Ugb3JkNHRldHJvaWQKewogICAgc3RhdGljIGNsYXNzIFByb2dyYW0KICAgIHsKICAgICAgICBzdGF0aWMgc3RyaW5nW10gTCA9IHsgIjAwMDExMTIxIiwgIjAwMDEwMjEwIiwgIjAwMTAyMDIxIiwgIjAyMTAxMTEyIiwgIjAxMTEyMDIxIiwgIjAwMDEwMjEyIiwgIjAwMDExMDIwIiwgIjAwMTAxMTEyIiB9OwogICAgICAgIHN0YXRpYyBzdHJpbmdbXSBJID0geyAiMDAwMTAyMDMiLCAiMDAxMDIwMzAiLCB9OwogICAgICAgIHN0YXRpYyBzdHJpbmdbXSBUID0geyAiMDAxMDExMjAiLCAiMDExMDExMTIiLCAiMDExMDExMjEiLCAiMDAwMTAyMTEiLCB9OwogICAgICAgIHN0YXRpYyBzdHJpbmdbXSBPID0geyAiMDAwMTEwMTEiLCB9OwogICAgICAgIHN0YXRpYyBzdHJpbmdbXSBTID0geyAiMDAwMTExMTIiLCAiMDExMDExMjAiLCAiMDEwMjEwMTEiLCAiMDAxMDExMjEiLCB9OwoKICAgICAgICBzdGF0aWMgc3RyaW5nIHNvbHZlKHN0cmluZyBwb2ludHMpCiAgICAgICAgewogICAgICAgICAgICBpbnRbXSBhcnJheSA9IEFycmF5LkNvbnZlcnRBbGwocG9pbnRzLlNwbGl0KCcsJyksIGludC5QYXJzZSk7CiAgICAgICAgICAgIAogICAgICAgICAgICBBcnJheS5Tb3J0KGFycmF5KTsKCiAgICAgICAgICAgIC8vIOW3puS4iuOBq+WvhOOBm+OCiwogICAgICAgICAgICB3aGlsZSAoQXJyYXkuVHJ1ZUZvckFsbChhcnJheSwgaSA9PiBpICUgMTAgPj0gMSkpIGFycmF5ID0gQXJyYXkuQ29udmVydEFsbChhcnJheSwgaSA9PiBpIC0gMSk7CiAgICAgICAgICAgIHdoaWxlIChBcnJheS5UcnVlRm9yQWxsKGFycmF5LCBpID0+IGkgPj0gMTApKSBhcnJheSA9IEFycmF5LkNvbnZlcnRBbGwoYXJyYXksIGkgPT4gaSAtIDEwKTsKICAgICAgICAgICAgCiAgICAgICAgICAgIHN0cmluZyBpbnB1dFN0ciA9IHN0cmluZy5Kb2luKCIiLCBBcnJheS5Db252ZXJ0QWxsKGFycmF5LCBpID0+IGkuVG9TdHJpbmcoIjAwIikpKTsKICAgICAgICAgICAgaWYgKEFycmF5LkluZGV4T2YoTCwgaW5wdXRTdHIpICE9IC0xKSByZXR1cm4gIkwiOwogICAgICAgICAgICBpZiAoQXJyYXkuSW5kZXhPZihJLCBpbnB1dFN0cikgIT0gLTEpIHJldHVybiAiSSI7CiAgICAgICAgICAgIGlmIChBcnJheS5JbmRleE9mKFQsIGlucHV0U3RyKSAhPSAtMSkgcmV0dXJuICJUIjsKICAgICAgICAgICAgaWYgKEFycmF5LkluZGV4T2YoTywgaW5wdXRTdHIpICE9IC0xKSByZXR1cm4gIk8iOwogICAgICAgICAgICBpZiAoQXJyYXkuSW5kZXhPZihTLCBpbnB1dFN0cikgIT0gLTEpIHJldHVybiAiUyI7CiAgICAgICAgICAgIHJldHVybiAiLSI7CiAgICAgICAgfQoKCiAgICAgICAgc3RhdGljIHZvaWQgdGVzdChzdHJpbmcgaW5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MSw2MCw2Miw3MyIsICItIik7CiAgICAgICAgICAgIC8qIzQ5Ki8gdGVzdCgiNTksNzksNjksNDgiLCAiLSIpOwogICAgICAgICAgICAvKiM1MCovIHRlc3QoIjU1LDU3LDc3LDc1IiwgIi0iKTsKICAgICAgICB9CiAgICB9Cn0=
stdout
input: 55,55,55,55 expected: - received: - Judge: OK
input: 07,17,06,05 expected: L received: L Judge: OK
input: 21,41,31,40 expected: L received: L Judge: OK
input: 62,74,73,72 expected: L received: L Judge: OK
input: 84,94,74,75 expected: L received: L Judge: OK
input: 48,49,57,47 expected: L received: L Judge: OK
input: 69,89,79,68 expected: L received: L Judge: OK
input: 90,82,91,92 expected: L received: L Judge: OK
input: 13,23,03,24 expected: L received: L Judge: OK
input: 24,22,25,23 expected: I received: I Judge: OK
input: 51,41,21,31 expected: I received: I Judge: OK
input: 64,63,62,65 expected: I received: I Judge: OK
input: 49,69,59,79 expected: I received: I Judge: OK
input: 12,10,21,11 expected: T received: T Judge: OK
input: 89,99,79,88 expected: T received: T Judge: OK
input: 32,41,43,42 expected: T received: T Judge: OK
input: 27,16,36,26 expected: T received: T Judge: OK
input: 68,57,58,67 expected: O received: O Judge: OK
input: 72,62,61,71 expected: O received: O Judge: OK
input: 25,24,15,14 expected: O received: O Judge: OK
input: 43,54,53,42 expected: S received: S Judge: OK
input: 95,86,76,85 expected: S received: S Judge: OK
input: 72,73,84,83 expected: S received: S Judge: OK
input: 42,33,32,23 expected: S received: S Judge: OK
input: 66,57,67,58 expected: S received: S Judge: OK
input: 63,73,52,62 expected: S received: S Judge: OK
input: 76,68,77,67 expected: S received: S Judge: OK
input: 12,11,22,01 expected: S received: S Judge: OK
input: 05,26,06,25 expected: - received: - Judge: OK
input: 03,11,13,01 expected: - received: - Judge: OK
input: 11,20,00,21 expected: - received: - Judge: OK
input: 84,95,94,86 expected: - received: - Judge: OK
input: 36,56,45,35 expected: - received: - Judge: OK
input: 41,33,32,43 expected: - received: - Judge: OK
input: 75,94,84,95 expected: - received: - Judge: OK
input: 27,39,28,37 expected: - received: - Judge: OK
input: 45,34,54,35 expected: - received: - Judge: OK
input: 24,36,35,26 expected: - received: - Judge: OK
input: 27,27,27,27 expected: - received: - Judge: OK
input: 55,44,44,45 expected: - received: - Judge: OK
input: 70,73,71,71 expected: - received: - Judge: OK
input: 67,37,47,47 expected: - received: - Judge: OK
input: 43,45,41,42 expected: - received: - Judge: OK
input: 87,57,97,67 expected: - received: - Judge: OK
input: 49,45,46,48 expected: - received: - Judge: OK
input: 63,63,52,72 expected: - received: - Judge: OK
input: 84,86,84,95 expected: - received: - Judge: OK
input: 61,60,62,73 expected: - received: - Judge: OK
input: 59,79,69,48 expected: - received: - Judge: OK
input: 55,57,77,75 expected: - received: - Judge: OK