Submission #8610592


Source Code Expand

Copy
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

int digits(int n) {
	int d = 0;
	while(n>0) {
		n/=10;
		d++;
	}
	return d;
}
signed main() {
	int a,b,x;
	std::cin >> a >> b >> x;
	int l=0;int r=1e9+1;
	while(r-l>1) {
		int mid = (l+r)/2;
		if(a*mid+b*digits(mid)<=x) l=mid;
		else r=mid;
	}
	print(l);
	return 0;
}

Submission Info

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

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 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