結果

問題 No.344 ある無理数の累乗
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-04-22 13:06:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 397 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 166,976 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-28 21:17:06
合計ジャッジ時間 6,619 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)



int N;
int g(int x) {
    if (x < 2) return 2;
    return (2 * g(x - 1) + 2 * g(x - 2)) % 1000;
}
//-----------------------------------------------------------------------------------
int main() {
    cin >> N;

    int ans = g(N);
    if (N % 2 == 0) ans = (ans - 1 + 1000) % 1000;
    cout << ans << endl;
}
0