_no0B

Untitled

Dec 6th, 2021
794
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. #define LL long long
  3. #define N ((int)6e4 + 5)
  4. #define MOD ((int)998244353 + 0)
  5. #define MAX ((int)1e9 + 7)
  6. #define MAXL ((ll)1e18 + 7)
  7. #define MAXP ((int)1e3 + 7)
  8. #define thr 1e-8
  9. #define pi acos(-1)  /// pi = acos ( -1 )
  10. #define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
  11. #define endl "\n"
  12.  
  13. using namespace std;
  14.  
  15.  
  16.  
  17. int main()
  18. {
  19.  
  20.     string num;
  21.     cin>>num;
  22.     int n = num.length;
  23.     int ans = 0;
  24.     for(int i = 0 ; i < n ; i++){
  25.         int digit = num[i] - '0';
  26.         int left = i+1 , right = n - i - 1;
  27.         ans += 1LL*left * digit % MOD * ( BigMod(10 , right + 1) - 1 + MOD) % MOD * BigMod(9 , MOD-2) % MOD;
  28.         ans %= MOD;
  29.     }
  30.  
  31.     cout<<ans<<endl;
  32.  
  33.     return 0;
  34. }
  35.  
RAW Paste Data