結果

問題 No.2600 Avator Height
ユーザー neko_the_shadowneko_the_shadow
提出日時 2024-02-14 10:13:04
言語 Rust
(1.77.0)
結果
AC  
実行時間 341 ms / 2,000 ms
コード長 790 bytes
コンパイル時間 7,963 ms
コンパイル使用メモリ 169,172 KB
実行使用メモリ 9,684 KB
最終ジャッジ日時 2024-02-14 10:13:26
合計ジャッジ時間 21,103 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
8,148 KB
testcase_01 AC 311 ms
9,684 KB
testcase_02 AC 307 ms
9,684 KB
testcase_03 AC 313 ms
9,684 KB
testcase_04 AC 337 ms
9,684 KB
testcase_05 AC 315 ms
9,684 KB
testcase_06 AC 312 ms
9,684 KB
testcase_07 AC 339 ms
9,684 KB
testcase_08 AC 312 ms
9,684 KB
testcase_09 AC 315 ms
9,684 KB
testcase_10 AC 312 ms
9,684 KB
testcase_11 AC 311 ms
9,684 KB
testcase_12 AC 311 ms
9,684 KB
testcase_13 AC 310 ms
9,684 KB
testcase_14 AC 316 ms
9,684 KB
testcase_15 AC 308 ms
9,684 KB
testcase_16 AC 314 ms
9,684 KB
testcase_17 AC 341 ms
9,684 KB
testcase_18 AC 311 ms
9,684 KB
testcase_19 AC 314 ms
9,684 KB
testcase_20 AC 314 ms
9,684 KB
testcase_21 AC 316 ms
9,684 KB
testcase_22 AC 309 ms
9,684 KB
testcase_23 AC 309 ms
9,684 KB
testcase_24 AC 283 ms
9,684 KB
testcase_25 AC 283 ms
9,684 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `R` should have a snake case name
 --> Main.rs:4:13
  |
4 |     let mut R = vec![0u128; 200000+1];
  |             ^ help: convert the identifier to snake case: `r`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: variable `E` should have a snake case name
 --> Main.rs:5:13
  |
5 |     let mut E = vec![0u128; 200000+1];
  |             ^ help: convert the identifier to snake case: `e`

warning: variable `Q` should have a snake case name
  --> Main.rs:15:9
   |
15 |     let Q = input();
   |         ^ help: convert the identifier to snake case: `q`

warning: variable `N` should have a snake case name
  --> Main.rs:16:9
   |
16 |     let N = (0..Q).map(|_| input()).collect::<Vec<_>>();
   |         ^ help: convert the identifier to snake case: `n`

warning: 4 warnings emitted

ソースコード

diff #

use std::io::stdin;

fn main() {
    let mut R = vec![0u128; 200000+1];
    let mut E = vec![0u128; 200000+1];
    R[1] = 1;
    R[2] = 1;
    E[1] = 1;
    E[2] = 3;
    for i in 3..200000+1 {
        R[i] = (R[i-1]+R[i-2])%998244353;
        E[i] = (E[i-1]+E[i-2])%998244353;
    }

    let Q = input();
    let N = (0..Q).map(|_| input()).collect::<Vec<_>>();
    for n in N {
        let mut ans = 1;
        ans *= (R[n]*R[n])%998244353;
        ans %= 998244353;
        ans *= 5;
        ans %= 998244353;

        ans += 998244353;
        ans -= (E[n]*E[n])%998244353;
        ans %= 998244353;
        
        println!("{}", ans);
    }
}

fn input() -> usize {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().parse::<_>().unwrap()
}
0