23dfcca431 2011-02-23 kinaba: ///////////////////////////////////////////////////////////////////////////// 23dfcca431 2011-02-23 kinaba: // Written in 23dfcca431 2011-02-23 kinaba: // ActionScript (using mtasc 1.14) 23dfcca431 2011-02-23 kinaba: // http://www.mtasc.org/ 23dfcca431 2011-02-23 kinaba: ///////////////////////////////////////////////////////////////////////////// 23dfcca431 2011-02-23 kinaba: 23dfcca431 2011-02-23 kinaba: class A 23dfcca431 2011-02-23 kinaba: { 23dfcca431 2011-02-23 kinaba: static function main(mc) 23dfcca431 2011-02-23 kinaba: { 23dfcca431 2011-02-23 kinaba: var input_string = "<paste the input data here>"; 23dfcca431 2011-02-23 kinaba: var input = input_string.split("\n"); 23dfcca431 2011-02-23 kinaba: var T = Number(input[0]); 23dfcca431 2011-02-23 kinaba: 23dfcca431 2011-02-23 kinaba: var output_string = "" 23dfcca431 2011-02-23 kinaba: for(var C=1; C<=T; ++C) 23dfcca431 2011-02-23 kinaba: { 23dfcca431 2011-02-23 kinaba: var theCase = input[C].split(" "); 23dfcca431 2011-02-23 kinaba: var N = Number(theCase[0]); 23dfcca431 2011-02-23 kinaba: var K = Number(theCase[1]); 23dfcca431 2011-02-23 kinaba: output_string += "Case #" + C + ": " + (solve(N,K)?"ON":"OFF") + "\n" 23dfcca431 2011-02-23 kinaba: } 23dfcca431 2011-02-23 kinaba: 23dfcca431 2011-02-23 kinaba: _root.createTextField("tf",0,0,0,800,600); 23dfcca431 2011-02-23 kinaba: _root.tf.text = output_string; 23dfcca431 2011-02-23 kinaba: } 23dfcca431 2011-02-23 kinaba: 23dfcca431 2011-02-23 kinaba: static function solve(N, K) 23dfcca431 2011-02-23 kinaba: { 23dfcca431 2011-02-23 kinaba: var mask = (1<<N) - 1; 23dfcca431 2011-02-23 kinaba: return (K & mask) == mask; 23dfcca431 2011-02-23 kinaba: } 23dfcca431 2011-02-23 kinaba: }