Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- vector<int>x;
- vector<int>z;
- vector<int>inmultire(vector<int> x, int y)
- {
- vector<int>aux;
- int t=0;
- for(int i=0; i<x.size(); i++)
- {
- t=t+x[i]*y;
- aux.push_back(t%10);
- t/=10;
- }
- while(t!=0)
- {
- aux.push_back(t%10);
- t/=10;
- }
- reverse(aux.begin(), aux.end());
- return aux;
- }
- vector<int>power(int e, int b)
- {
- int aux=e;
- vector<int> cv;
- if(b==0)
- {
- cout<<"1";
- }
- while(aux)
- {
- z.push_back(aux%10);
- aux/=10;
- }
- for(int i=1; i<=b; i++)
- {
- cv = inmultire(z,e);
- }
- reverse(z.begin(), z.end());
- for(const auto &it : z)
- {
- cout<<it;
- }
- }
- int main()
- {
- int f,n;
- cin>>f>>n;
- power(f,n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment