Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <cstdio>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. long long r;
  8.  
  9. void func(string &s) {
  10.     r += s.size();
  11. }
  12.  
  13. int main() {
  14.     for (int i = 1; i < 1e10; i ++) {
  15.         char tmp[13];
  16.         string input;
  17.         for (int j = 0, x = i; x > 0; j ++, x /= 10) {
  18.             tmp[j] = (x % 10) + '0';
  19.             tmp[j + 1] = 0;
  20.         }
  21.         input = string(tmp);
  22.         func(input);
  23.     }
  24.  
  25.     printf("%lld\n", r);
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement