結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー はとばねぇはとばねぇ
提出日時 2019-04-26 17:42:31
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 449 bytes
コンパイル時間 33 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 39,552 KB
最終ジャッジ日時 2024-04-21 02:37:58
合計ジャッジ時間 772 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
39,168 KB
testcase_01 AC 64 ms
39,424 KB
testcase_02 AC 68 ms
39,424 KB
testcase_03 AC 67 ms
39,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Answer {
	constructor(input) {
		this.data = Number(input);
		this.ans = '';
	}

	main() {
		for(let i=0;this.data>i;i++) {
			this.FizzBuzz((i+1));
			this.dest(this.ans);
		}
	}

	FizzBuzz(num) {
		if(num % 3 === 0) this.ans += 'Fizz';
		if(num % 5 === 0) this.ans += 'Buzz';
		if(this.ans === '') this.ans = num;
	}

	dest(ans) {
		console.log(ans);
		this.ans = '';
	}
}
new Answer(require("fs").readFileSync("/dev/stdin", "utf8")).main();
0