Topic Portal
1 /*2 water problem: To find the total number of numbers, open long long unexpectedly WA several times, also did not change what again:)3 */4#include <cstdio>5#include <iostream>6#include <algorithm>7#include <cstring>8#include <cmath>9#include <vector>Ten#include <string> One#include <queue> A#include <map> -#include <Set> - using namespacestd; the -typedefLong Longll; - Const intMAXN = 1e2 +Ten; - Const intINF =0x3f3f3f3f; + - intMainvoid)//codeforces Round #308 (Div. 2) B. Vanya and Books + { A //freopen ("b.in", "R", stdin); at - ll N; - while(SCANF ("%i64d", &n) = =1) - { - intLen =0; ll tmp =N; - while(TMP) in { -TMP/=Ten; len++; to } + -ll ans =0; ll x =9; the for(intI=1; i<=len-1; ++i) * { $Ans + = x * i; X *=Ten;Panax Notoginseng } -ll y =1; the for(intI=1; i<=len-1; ++i) y *=Ten; + AAns + = (n-y +1) *Len; theprintf ("%i64d\n", ans); + } - $ $ return 0; -}
Mathematics codeforces Round #308 (Div. 2) B. Vanya and Books