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