結果

問題 No.793 うし数列 2
ユーザー 826814741_6826814741_6
提出日時 2019-03-07 17:04:56
言語 Bash
(Bash 5.1.16)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 19:26:03
合計ジャッジ時間 1,095 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

f () {
	local n=$1; local p=$2; local m=$3
	local r=1
	while [ $p -gt 0 ]; do
		if [ $(($p & 1)) -eq 1 ]; then
			r=$(($r * $n % $m))
		fi
		n=$(($n * $n % $m)); p=$(($p >> 1))
	done
	printf $r
}

D=1000000007

read n
echo $(($(($(f 10 $n $D) * 4 % $D - 1)) * $(f 3 $(($D - 2)) $D) % $D))
0