当前位置:网站首页>P3811 [template] multiplicative inverse
P3811 [template] multiplicative inverse
2022-06-11 07:09:00 【qq_ forty-six million five hundred and eighty thousand two hund】
P3811 【 Templates 】 Multiplicative inverse element
O(n) seek 1~n Inverse element
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,p;
int inv[3000005];
int main()
{
scanf("%d%d",&n,&p);
inv[1]=1;
printf("1\n");
for(int i=2;i<=n;i++)
{
inv[i]=1ll*(p-p/i)*inv[p%i]%p;
printf("%d\n",inv[i]);
}
return 0;
}
边栏推荐
- Aircraft battle from scratch (III) flight between player aircraft and enemy aircraft
- Object. Specific implementation and difference between create() and new
- Leetcode-141. Linked List Cycle
- Leetcode hot topic 100 topic 11-15 solution
- No response from win10 explorer when dragging files
- Common modules of saltstack
- Leetcode-9.Palindrome Numbber
- [deploy private warehouse based on harbor] 4 push image to harbor
- 1734. arrangement after decoding XOR
- 554. brick wall
猜你喜欢

1266_ Implementation analysis of FreeRTOS scheduler startup code

VTK vtkplane and vtkcutter use

Latex various arrows / arrows with text labels / variable length arrows

Senior openstacker - Bloomberg, vexxhost upgraded to gold member of openinfra Foundation
![[probability theory and mathematical statistics] Dr. monkey's notes p41-44 statistics related topics, determination of three distributions, properties, statistics subject to normal distribution in gen](/img/93/d1014b07c924195e062dc83d69b14a.png)
[probability theory and mathematical statistics] Dr. monkey's notes p41-44 statistics related topics, determination of three distributions, properties, statistics subject to normal distribution in gen

Biological sequence intelligent analysis platform blog (1)

Saltstack deployment LNMP

LEARNING TARGET-ORIENTED DUAL ATTENTION FOR ROBUST RGB-T TRACKING

byte和bit的区别
![[deploy private warehouse based on harbor] 4 push image to harbor](/img/af/8e28b229d94f3e6eab02308b69dc74.jpg)
[deploy private warehouse based on harbor] 4 push image to harbor
随机推荐
byte和bit的区别
Saltstack deployment LNMP
Aircraft battle from scratch (III) flight between player aircraft and enemy aircraft
Heartless sword Chinese English bilingual poem 001 Love
saltstack部署lnmp
【LeetCode】-- 17.电话号码的字母组合
Interview question 02.06 Palindrome linked list
Group arrays by a specified size
Flutter 约束容器组件
Practice: how to reasonably design functions to solve practical problems in software development (I)
[advanced concurrency] - thread pool summary
Difference between byte and bit
生物序列智能分析平台blog(1)
Server parameter adjustment record
Stack -- one of two common linear structures of linear structure
教育专家王中泽老师多年经验分享:家庭教育不是附庸品
Nodejs database (Part 2)
AtomicInteger原子操作类
News web page display
顶流编辑器 Atom,将于 12 月 15 日退出历史舞台