結果

問題 No.314 ケンケンパ
ユーザー LeonardoneLeonardone
提出日時 2015-12-08 20:54:47
言語 Bash
(Bash 5.1.16)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 5,156 KB
実行使用メモリ 11,880 KB
最終ジャッジ日時 2023-10-12 22:09:47
合計ジャッジ時間 4,519 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/bin/bash

# yukicoder My Practice
# author: Leonardone @ NEETSDKASU

# 解説読後
# http://yukicoder.me/problems/882/editorial

typeset -i n a b c t x u

mapfile -t n

a=0
b=1
c=0

if [[ $n -eq 2 ]]; then {
    t=$((b+c));
    c=$b;
    b=$a;
    a=$t;
}; elif [[ $n -gt 2 ]]; then {
    x=$((n % 2));
    if [[ $x -eq 0 ]]; then {
        t=$((b+c));
        c=$b;
        b=$a;
        a=$t;
        n=$((n-1));
    }; fi;
    for ((n=$n-1;$n;n=$n-2)); do {
        t=$((b+c));
        c=$a;
        a=$(((a+b) % 1000000007));
        b=$t;
    }; done;
}; fi;

t=$(((a+b+c) % 1000000007))

echo $t
0