提出 #36980209


ソースコード 拡げる

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double PI = acos(-1);

using mint = modint998244353;

int main() {
    int n, p;
    cin >> n >> p;
    mint two = mint(p)/100, one = mint(1) - two;
    vector<mint> dp(n+1);
    for (int i = 1; i <= n; i++) {
        dp[i] += dp[i-1]*one;
        if (i-2 >= 0) dp[i] += dp[i-2]*two;
        dp[i] += 1;
    }
    cout << dp[n].val() << endl;
    return 0;
}

提出情報

提出日時
問題 E - Critical Hit
ユーザ taki0711
言語 C++ (GCC 9.2.1)
得点 500
コード長 778 Byte
結果 AC
実行時間 16 ms
メモリ 4088 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 3
AC × 39
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 16 ms 3588 KiB
example_01.txt AC 2 ms 3604 KiB
example_02.txt AC 2 ms 3644 KiB
hand_00.txt AC 2 ms 3604 KiB
hand_01.txt AC 2 ms 3556 KiB
hand_02.txt AC 2 ms 3608 KiB
hand_03.txt AC 2 ms 3600 KiB
hand_04.txt AC 2 ms 3428 KiB
hand_05.txt AC 2 ms 3512 KiB
hand_06.txt AC 6 ms 4020 KiB
hand_07.txt AC 5 ms 3996 KiB
hand_08.txt AC 6 ms 4012 KiB
hand_09.txt AC 5 ms 4088 KiB
hand_10.txt AC 5 ms 3628 KiB
hand_11.txt AC 6 ms 4084 KiB
hand_12.txt AC 3 ms 3668 KiB
hand_13.txt AC 7 ms 3424 KiB
random_00.txt AC 3 ms 3648 KiB
random_01.txt AC 3 ms 3568 KiB
random_02.txt AC 2 ms 3448 KiB
random_03.txt AC 5 ms 3476 KiB
random_04.txt AC 5 ms 3472 KiB
random_05.txt AC 6 ms 3512 KiB
random_06.txt AC 4 ms 3508 KiB
random_07.txt AC 6 ms 3736 KiB
random_08.txt AC 5 ms 3424 KiB
random_09.txt AC 6 ms 3820 KiB
random_10.txt AC 8 ms 3656 KiB
random_11.txt AC 7 ms 3724 KiB
random_12.txt AC 5 ms 4036 KiB
random_13.txt AC 7 ms 4024 KiB
random_14.txt AC 6 ms 3736 KiB
random_15.txt AC 8 ms 4032 KiB
random_16.txt AC 6 ms 3856 KiB
random_17.txt AC 10 ms 3924 KiB
random_18.txt AC 9 ms 4000 KiB
random_19.txt AC 6 ms 4012 KiB
random_20.txt AC 7 ms 3920 KiB
random_21.txt AC 6 ms 4024 KiB