Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
788 B
3
Indexable
#include <bits/stdc++.h>
#define endl '\n'
#define maxn 105
#define TASK bai1
#define For(i,a,b) for ( int i = a; i <= b; i++ )
#define Ford(i,a,b) for ( int i = a; i >= b; i-- )
#define MOD 10000

using namespace std;
int a1,n;
long long luythua(long x, long long ex)
{
    if(ex == 0) return 1;
    if(ex % 2 == 0)
    {
        long long half = luythua(x,ex / 2) % MOD;
        return ((half % MOD) * (half % MOD)) % MOD;
    } else return ((x % MOD) *(luythua(x,ex - 1) % MOD)) % MOD;
}
void inp()
{
    cin >> a1 >> n;
}
void solve()
{
    cout << luythua(a1,luythua(2,n - 1));
}
int main()
{
    ios_base:: sync_with_stdio(0);
    cin.tie(0);
    if(fopen("bai1.inp","r")){
        freopen("bai1.inp","r",stdin);
    }
    inp();
    solve();
}
Leave a Comment