P1353

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a,b,c;
ll mid,ans;
ll l=0,r=1000000000;
bool check(ll x){
	ll m=x*a;
	while(x){
		x/=10;
		m+=b;
	}
	if(m<=c) return true;
	return false;
}
int main(){
	cin>>a>>b>>c;
	while(l<=r){
		mid=(l+r)/2;
		if(check(mid)){
			l=mid+1;
			ans=mid;
		}
		else r=mid-1;
	}
	cout<<ans;
	return 0;
}

P1354

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m,now;
stack<pair<ll,ll> > e;
ll f[100001],s[100001],ans[100001];
ll foud(ll p){
	return p==f[p]?p:f[p]=foud(f[p]);
}
ll add(ll x,ll y){
	ll xx=x,yy=y;
	x=foud(x);
	y=foud(y);
	if(x!=y){
//		cout<<xx<<" "<<s[x]<<" "<<yy<<" "<<s[y]<<endl;
		ll ret=s[x]*s[y];
		f[x]=f[y];
		s[y]+=s[x];
		s[x]=0;
		return ret;
	}
	return 0;
}
int main(){
	cin>>n>>m;
	now=n*(n-1)/2;
	for(ll i=1;i<=m;i++){
		ll x,y;
		cin>>x>>y;
		e.push(make_pair(x,y));
	}
	for(ll i=1;i<=n;i++){
		f[i]=i;
		s[i]=1;
	}
	ll mm=m;
	ans[m]=now;
	while(m>1){
		now-=add(e.top().first,e.top().second);
		ans[m-1]=now;
		e.pop();
		m--;
	}
	for(ll i=1;i<=mm;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

P1355

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
string s[51],e;
bool vis[100];
char p[5][9]={{0,0,0,0,0,0,0,0,0},{0,'*','*','*','A','B','C','D','E'},{0,'F','G','H','I','J','K','L','M'},{0,'N','O','P','Q','R','S','T','U'},{0,'V','W','X','Y','Z','*','*','*'}};
int main(){
	cin>>n;
	for(ll i=1;i<=n;i++){
		cin>>s[i];
	}
	cin>>e;
	for(ll i=1;i<=n;i++){
		if(s[i].substr(0,e.length())==e){
			vis[(ll)(s[i][e.length()])]=true;
		}
	}
	for(ll i=1;i<=4;i++){
		for(ll j=1;j<=8;j++){
			if(vis[p[i][j]]){
				cout<<p[i][j];
			}
			else cout<<'*';
		}
		cout<<endl;
	}
	return 0;
}