提出 #26632101


ソースコード 拡げる

function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

const DEBUG = process.env.DEBUG

function test(...msg) {
    if (DEBUG) console.log(...msg)
}

// const [ a, b, c ] = readMany(3)

(() => {
    let s = readMany(1)[0]

    let min = s
    let max = s

    function shiftRight(str) {
        return str[str.length - 1] + str.slice(0, str.length - 1)
    }

    for (let i = 0; i < s.length; i += 1) {
        s = shiftRight(s)
        if (s < min) min = s
        if (s > max) max = s
    }

    console.log(min)
    console.log(max)
})()

// cat $1 | DEBUG=1 node $1.js

提出情報

提出日時
問題 B - String Shifting
ユーザ comameito
言語 JavaScript (Node.js 12.16.1)
得点 200
コード長 788 Byte
結果 AC
実行時間 56 ms
メモリ 30508 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 15
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, handmade_00.txt, handmade_01.txt, handmade_02.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 56 ms 29588 KiB
example_01.txt AC 48 ms 29572 KiB
example_02.txt AC 48 ms 29720 KiB
handmade_00.txt AC 52 ms 29624 KiB
handmade_01.txt AC 53 ms 29624 KiB
handmade_02.txt AC 52 ms 29628 KiB
test_00.txt AC 54 ms 30484 KiB
test_01.txt AC 48 ms 30444 KiB
test_02.txt AC 52 ms 30492 KiB
test_03.txt AC 48 ms 29748 KiB
test_04.txt AC 48 ms 30456 KiB
test_05.txt AC 48 ms 29600 KiB
test_06.txt AC 52 ms 30508 KiB
test_07.txt AC 52 ms 29712 KiB
test_08.txt AC 48 ms 29860 KiB