Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define fastread()(ios_base:: sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- fastread();
- ll n,res;
- cin>>n;
- res=n/10;
- res=res*10-1;
- //cout<<n<<" "<<res<<endl;
- ll x=1,y=1,mx,sub=res;
- while(n>0)
- {
- x*=(n%10);
- n/=10;
- }
- while(res>0)
- {
- y*=(res%10);
- res/=10;
- }
- mx=max(x,y);
- ll i=100;
- while(sub>i)
- {
- res=sub/i;
- res=res*i-1;
- y=1;
- while(res>0)
- {
- y*=(res%10);
- res/=10;
- }
- mx=max(mx,y);
- i*=10;
- }
- cout<<mx<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement