Untitled
unknown
plain_text
3 years ago
680 B
4
Indexable
// // Created by xingchaoyue on 2022/10/21. // #include<iostream> #include<cstdio> using namespace std; typedef long long ll; int main(){ ll n; cin>>n; ll temp = n; int di = 0; ll last = 0; while(temp!=0){ if(temp/10==0){ last = temp; } temp /= 10; di++; } di = di - 1; // cout<<di<<endl; if(di==0){ cout<<n<<endl; } else{ ll mod = 1; for(int i = 0;i<di;++i){ mod = mod *ll(10); } ll res = n%mod; if(res<mod/2){ cout<<mod*last<<endl; } else{ cout<<mod*(last+1)<<endl; } } }
Editor is loading...