文章

119

粉丝

0

获赞

172

访问

11.1k

头像
求S(n) 题解:
P1500
发布于2026年1月31日 12:10
阅读数 150

#include<iostream>
using namespace std;

typedef unsigned long long ull;

ull kmi(ull a,ull b,ull mod)
{
	ull res=1%mod;
	while(b)
	{
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

int main()
{
	ull n;
	while(cin>>n)
	{
		cout<<kmi(n,5,3)<<endl;
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发