快速幂
蓝鲸
这个作者很懒,什么都没留下…
展开
-
快速幂
Description 求a的b次方对p取模的值,其中 0 ≤ a,b,p ≤ 109 扩展题目:POJ1995 Raising Modulo Numbers Input a,b,p Output 输出a的b次方对p取模的值 Sample Input 123478623 0 1000000000 Sample Output 1 本题如用一般的思想是循环b次每层循环进行乘积运算并进行求模运算,所以这...原创 2019-04-08 22:25:19 · 121 阅读 · 0 评论 -
数数
以下是第二个公式的结果 #include<iostream> using namespace std; #define ll long long int t; ll n;//用ll 定义n是因为要用到n的乘运算可能会查过整数范围 const int p=998244353; const int maxn=1e6+10; ll a[maxn]={1}; //这里的maxn是数据范围除...原创 2019-09-21 23:26:07 · 174 阅读 · 0 评论