fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int digits(int x){
  5. return to_string(x).length();
  6. }
  7.  
  8. int main() {
  9. int n; cin >> n;
  10. vector<int> arr(n);
  11. for(int i = 0; i < n; i++)
  12. cin >> arr[i];
  13.  
  14. long long sum = 0;
  15. long long ans = 0;
  16. for(int i = 0; i < n; i++){
  17. int y = digits(arr[i]);
  18. ans = ans + sum*pow(10,y) + arr[i]*i;
  19. sum += arr[i];
  20. }
  21. cout << ans % 998244353;
  22. return 0;
  23. }
Success #stdin #stdout 0s 5324KB
stdin
3
0 3 14 15
stdout
331