You are given an array of integers a1,a2,…,an and an integer xxx. Output the number of subsegments [l,r][l,r][l,r] where 1≤l≤r≤n1 le l le r le n1≤l≤r≤n such that alal+1…ar≡xmod998,244,353a_l cdot a_{l+1}cdot ldots cdot a_r equiv x mod 998,244,353alal+1…
You are given an array of integers a1,a2,…,ana_1,a_2,ldots,a_na1,a2,…,an and an integer xxx. Output the number of subsegments [l,r][l,r][l,r] where 1≤l≤r≤n1 le l le r le n1≤l≤r≤n such that al⋅al+1⋅…⋅ar≡xmod 998,244,353a_l cdot a_{l+1}cdot ldots cdot a_r equiv x mod 998,244,353al⋅al+1⋅…⋅ar≡xmod998,244,353.
(图片来源网络,侵删)