結果

問題 No.314 ケンケンパ
ユーザー Leonardone
提出日時 2015-12-08 20:54:47
言語 Bash
(Bash 5.2.21)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 17,352 KB
最終ジャッジ日時 2024-09-14 20:23:31
合計ジャッジ時間 4,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

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