BCSP2024JR3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<iostream>
using namespace std;
int fun_1(int x,int y){
    long long res = 0,t = 1;
     while(t<=x/y){
        res++;
        t*=y;
    }
    return res;
}
int fun_2(int y){
    long long l=0,r=y,mid;
    while(l<r){
        mid = (l+r+1)/2;
        if(mid>y/mid){
        r = mid-1;
        }
        else{
             l = mid;
        }
}
return l;
}
int main(){
    int a,b;
    cin >> a >> b;
    cout << fun_1( a , b ) << " ";
    cout << fun_1( fun_2(a) , b );
    return 0;
}
Scroll to Top