PAST #16 第16回 アルゴリズム実技検定(過去問)
- F - 式の評価
https://atcoder.jp/contests/past16-open/tasks/past202309_f
- 提出: https://atcoder.jp/contests/past16-open/submissions/48919008
1*
が最初についているものとして考える- 連続する数字は一つ前までの数字を 10 倍していまの数字を足して mod とったもの
'*'
では一つ前までに処理したものと掛け合わせて mod とったもの
use ac_library::ModInt998244353 as ModInt; use proconio::{input, marker::Chars}; fn main() { input! { s: Chars, }; let mut prev = ModInt::new(1); let mut curr = ModInt::new(0); for c in s { if c == '*' { prev *= curr; curr = ModInt::new(0); } else { curr *= 10; curr += (c as u8 - b'0') as u64; } } prev *= curr; let ans = prev; println!("{}", ans); }
今日のコミット。
- rust-atcoder 1 commit
- firestore-path 2 commits
- expo-push-notification-client-rust 0 commit