Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- long long n,p,k;
- cin>>n>>p>>k;
- if(pow(10,p+k)/10>n)
- cout<<"imposibil";
- else
- {
- long long ogl=0,putere=1;
- while(k>0)
- {
- ogl=ogl*10+n%10;
- putere*=10;
- k--;
- n/=10;
- }
- while(n>pow(10,p))
- {
- ogl=putere*(n%10)+ogl;
- putere*=10;
- n/=10;
- }
- long long oglp=0;
- while(n>0)
- {
- oglp=oglp*10+n%10;
- n/=10;
- }
- oglp=oglp*putere+ogl;
- cout<<oglp;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement