Topic Portal
1 /*2 Math: The problem has been WA in 13 groups, read the data only to know that the calculation cost is super long long3 In addition, the number of direct calculations for a single interval can be4 */5#include <cstdio>6#include <cmath>7#include <iostream>8#include <algorithm>9#include <cstring>Ten using namespacestd; One Atypedef unsignedLong Longull; - intGet_len (ull x) - { the intRET =0; - while(x) { -X/=Ten; ret++; - } + returnret; - } + A at intMainvoid)//codeforces Round #219 (Div. 2) b. Making sequences are fun - { - //freopen ("b.in", "R", stdin); - - ull W, M, K; - while(Cin >> W >> M >>k) { in intLen = Get_len (m); ull mx =0; - for(intI=1; i<=len; ++i) { toMX = mx *Ten+9; + } - theull ans =0; ull cost = (mx-m +1) * k *Len; * while(Cost <=W) { $W-= Cost; Ans + = (mx-m +1);Panax Notoginsenglen++; m = mx +1; MX = mx *Ten+9; -Cost = (Mx-m +1) * k *Len; the } + AAns + = w/(LEN *k); thecout << ans <<Endl; + } - $ return 0; $}
1#include <cstdio>2#include <cmath>3#include <iostream>4#include <algorithm>5#include <cstring>6 using namespacestd;7 8typedefLong Longll;9 intGet_len (ll x)Ten { One intRET =0; A while(x) { -X/=Ten; ret++; - } the returnret; - } - - + intMainvoid)//codeforces Round #219 (Div. 2) b. Making sequences are fun - { + //freopen ("b.in", "R", stdin); A at ll W, M, K; - while(SCANF ("%i64d%i64d%i64d", &w, &m, &k) = =3) { - intLen = Get_len (m); ll mx =0; - for(intI=1; i<=len; ++i) { -MX = mx *Ten+9; - } in -ll ans =0, now =0, tot =0; to while(true) { +now = Mx-m +1; tot = w/(k *len); - if(Now <tot) { theans + = now; W-= now * k *Len; *m = mx +1; MX = mx *Ten+9; len++; $ }Panax Notoginseng Else { -ans + = tot; Break; the } + } A theprintf ("%i64d\n", ans); + } - $ return 0; $}
Compare by Number
Mathematics codeforces Round #219 (Div. 2) B. Making Sequences is fun