結果
問題 | No.3053 $((0 \And 1)\mathop{|}2)\oplus 3$ |
ユーザー |
![]() |
提出日時 | 2025-03-07 22:16:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 418 ms / 2,000 ms |
コード長 | 728 bytes |
コンパイル時間 | 4,466 ms |
コンパイル使用メモリ | 252,984 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-08 00:10:53 |
合計ジャッジ時間 | 10,229 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000000 #define Inf64 1000000000000000001LL int main(){ string s; cin>>s; long long cur = 0; reverse(s.begin(),s.end()); vector<mint> t(s.size()); rep(i,s.size()){ if(s[i]=='1'){ t[i] = mint(2) / mint(3); cur += pow_mod(2,i,998244352); } else{ mint tt = mint(2) / mint(3); t[i] = tt.pow(cur+2); } cur %= 998244352; } mint All = mint(3).pow(cur); mint ans = 0; rep(i,s.size()){ mint tt = mint(2).pow(i); tt *= All; tt *= t[i]; ans += tt; } cout<<ans.val()<<endl; return 0; }