Mathematics codeforces Round #219 (Div. 2) B. Making Sequences is fun

Source: Internet
Author: User
Tags cmath

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.