結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー ブルーレヰブルーレヰ
提出日時 2020-07-03 13:56:52
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,782 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 5,232 KB
実行使用メモリ 44,004 KB
最終ジャッジ日時 2023-10-14 23:30:38
合計ジャッジ時間 2,648 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
44,004 KB
testcase_01 AC 76 ms
41,716 KB
testcase_02 AC 76 ms
42,444 KB
testcase_03 AC 77 ms
41,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// いっそプリミティブ値のリテラルも書かないっていうのはどうだ
const zero = +[];
const one = +!![];
const two = one + one;
const three = one + two;
const four = two * two;
const five = two + three;
const six = two * three;
const seven = three + four;
const eight = two * four;
const nine = three * three;
const ten = two * five;
const fifteen = three * five;
const handred = ten * ten;

const slash = String.fromCharCode(four * ten + seven);
const B = String.fromCharCode(six * ten + six);
const F = String.fromCharCode(seven * ten);
const d = String.fromCharCode(handred);
const e = String.fromCharCode(handred + one);
const f = String.fromCharCode(handred + two);
const i = String.fromCharCode(handred + five);
const n = String.fromCharCode(handred + ten);
const s = String.fromCharCode(handred + fifteen);
const t = String.fromCharCode(handred + ten + six);
const u = String.fromCharCode(handred + ten + seven);
const v = String.fromCharCode(handred + ten + eight);
const z = String.fromCharCode(handred + two * ten + two);

const Fizz = F + i + z + z;
const Buzz = B + u + z + z;
const FizzBuzz = Fizz + Buzz;

const fs = f + s;
const stdin = slash + d + e + v + slash + s + t + d + i + n;
const utf = u + t + f;
const encoding = utf + eight;

function Main(input) {
    const N = +input;
    
    for (let i = one; i <= N; ++i) {
        let str;
        if (i % fifteen == zero) {
            str = FizzBuzz;
        } else if (i % five == zero) {
            str = Buzz;
        } else if (i % three == zero) {
            str = Fizz;
        } else {
            str = i;
        }
        console.log(str);
    }
}


// Don't edit this line!
// と言われてもいじらんと解答できんよ
Main(require(fs).readFileSync(stdin, encoding));
0