結果

問題 No.1114 足し算盆に返らず
ユーザー watarimaycry2watarimaycry2
提出日時 2020-07-17 22:06:45
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 2,321 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 83,060 KB
最終ジャッジ日時 2023-08-20 01:23:29
合計ジャッジ時間 12,205 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
82,852 KB
testcase_01 AC 181 ms
82,716 KB
testcase_02 AC 181 ms
82,948 KB
testcase_03 AC 178 ms
82,460 KB
testcase_04 AC 177 ms
82,988 KB
testcase_05 AC 173 ms
81,064 KB
testcase_06 AC 182 ms
83,060 KB
testcase_07 AC 183 ms
82,816 KB
testcase_08 AC 175 ms
81,412 KB
testcase_09 AC 174 ms
80,872 KB
testcase_10 AC 176 ms
81,200 KB
testcase_11 AC 147 ms
78,572 KB
testcase_12 AC 172 ms
81,724 KB
testcase_13 AC 184 ms
82,948 KB
testcase_14 AC 150 ms
78,592 KB
testcase_15 AC 171 ms
82,272 KB
testcase_16 AC 171 ms
81,100 KB
testcase_17 AC 179 ms
81,728 KB
testcase_18 AC 170 ms
79,732 KB
testcase_19 AC 171 ms
80,068 KB
testcase_20 AC 180 ms
82,928 KB
testcase_21 AC 167 ms
80,184 KB
testcase_22 AC 152 ms
78,140 KB
testcase_23 AC 151 ms
78,288 KB
testcase_24 AC 145 ms
78,352 KB
testcase_25 AC 154 ms
78,308 KB
testcase_26 AC 156 ms
80,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//↓見なくていいよ!ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = new Date();
  Main();
  var end = new Date() - start;
  
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ!ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var list = [1];
	for(var i = 0; i < 1000000; i++){
		list.push(list[list.length - 1] + 2);
	}
	var output = [];
	for(var i = 0; i < 1000000; i++){
		if(list[i] <= N){
			output.push(list[i]);
		}
	}
	myout(myconv(output,8));
}
0