Submission #8630477


Source Code Expand

#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 AC
Exec Time 1 ms
Memory 256 KiB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 16
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 KiB
border02 AC 1 ms 256 KiB
border03 AC 1 ms 256 KiB
corner01 AC 1 ms 256 KiB
max01 AC 1 ms 256 KiB
max02 AC 1 ms 256 KiB
max03 AC 1 ms 256 KiB
min01 AC 1 ms 256 KiB
min02 AC 1 ms 256 KiB
rnd01 AC 1 ms 256 KiB
rnd02 AC 1 ms 256 KiB
rnd03 AC 1 ms 256 KiB
sample01 AC 1 ms 256 KiB
sample02 AC 1 ms 256 KiB
sample03 AC 1 ms 256 KiB
sample04 AC 1 ms 256 KiB