文章

142

粉丝

0

获赞

343

访问

17.6k

头像
幂次方 题解:
P1017 贵州大学机试题
发布于2026年2月6日 11:05
阅读数 251

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 233333;

ll power(ll x, ll n) {
    ll res = 1;
    while (n) {
        if (n % 2 == 1) 
			res = res * x % MOD;
        x = x * x % MOD;
        n /= 2;
    }
    return res;
}

int main() {
    ll x, n;
    while (cin >> x >> n) 
		cout << power(x, n) << endl;
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发