Submission #8630477


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














ll A, B, X;
//---------------------------------------------------------------------------------------------------
ll check(ll x) {
	ll dx = to_string(x).length();
	return A * x + B * dx;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B >> X;
	ll ok = 0, ng = 1000000001;
	while (ok + 1 != ng) {
		ll md = (ok + ng) / 2;
		if (check(md) <= X) ok = md;
		else ng = md;
	}
	cout << ok << endl;
}





Submission Info

Submission Time
Task C - Buy an Integer
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1781 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
sample 0 / 0 sample01, sample02, sample03, sample04
All 300 / 300 border01, border02, border03, corner01, max01, max02, max03, min01, min02, rnd01, rnd02, rnd03, sample01, sample02, sample03, sample04
Case Name Status Exec Time Memory
border01 1 ms 256 KB
border02 1 ms 256 KB
border03 1 ms 256 KB
corner01 1 ms 256 KB
max01 1 ms 256 KB
max02 1 ms 256 KB
max03 1 ms 256 KB
min01 1 ms 256 KB
min02 1 ms 256 KB
rnd01 1 ms 256 KB
rnd02 1 ms 256 KB
rnd03 1 ms 256 KB
sample01 1 ms 256 KB
sample02 1 ms 256 KB
sample03 1 ms 256 KB
sample04 1 ms 256 KB