Submission #8613534
Source Code Expand
Copy
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define eb emplace_back typedef long long ll; typedef long double ld; const ll inf = 2e9; const ll base = 998244353; ll mod = 1e9 + 7; ll cnt(ll a) { ll ans = 0; while(a > 0) { ++ans; a /= 10; } return ans; } int main() { // srand(time(NULL)); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); // std::random_device rd; // std::mt19937 g(rd()); auto start = clock(); ll a, b, x; cin >> a >> b >> x; ll st = 0, en = 1000000000 + 1; while(en - st > 1) { ll mid = (st + en) / 2; if (a * mid + cnt(mid) * b > x) { en = mid; } else { st = mid; } } cout << st << endl; std::cerr << double(clock() - start) / CLOCKS_PER_SEC << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Buy an Integer |
User | PuRpLe_FoReVeR |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1031 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample01, sample02, sample03, sample04 |
All | border01, border02, border03, corner01, max01, max02, max03, min01, min02, rnd01, rnd02, rnd03, sample01, sample02, sample03, sample04 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
border01 | AC | 1 ms | 256 KB |
border02 | AC | 1 ms | 256 KB |
border03 | AC | 1 ms | 256 KB |
corner01 | AC | 1 ms | 256 KB |
max01 | AC | 1 ms | 256 KB |
max02 | AC | 1 ms | 256 KB |
max03 | AC | 1 ms | 256 KB |
min01 | AC | 1 ms | 256 KB |
min02 | AC | 1 ms | 256 KB |
rnd01 | AC | 1 ms | 256 KB |
rnd02 | AC | 1 ms | 256 KB |
rnd03 | AC | 1 ms | 256 KB |
sample01 | AC | 1 ms | 256 KB |
sample02 | AC | 1 ms | 256 KB |
sample03 | AC | 1 ms | 256 KB |
sample04 | AC | 1 ms | 256 KB |