c++
mokie.
这个作者很懒,什么都没留下…
展开
-
Cut Ribbon(背包)
Polycarpus has a ribbon, its length isn. He wants to cut the ribbon in a way that fulfils the following two conditions: After the cutting each ribbon piece should have lengtha,borc. After the cutting the number of ribbon pieces should be maximum. He...原创 2022-04-20 17:37:49 · 123 阅读 · 0 评论 -
CPA招新Ⅱ(PTA)
新学期开始啦,我们CPA是2019年6月成立的,创建时有20位元老。现在需要招新啦,每年新学期社团服务中心会组织百团大战。我们CPA迎来第一次招新,我们很期待迎来新成员。 每天都有元老去招新,每招到一个萌新,招新人会在纸上写一个大写字母。CPA共有竞赛部、宣传部、办公部、组织部四个部门。我们规定A代表竞赛部(Competition department),B代表宣传部(Propaganda Department)、C代表办公部(Office)、D组织部(Organization Department...原创 2022-04-16 20:36:33 · 240 阅读 · 0 评论 -
< 乘 法 逆 元 >
p为质数时,i的乘法逆元为 pow( i , p - 2 ); #include<iostream> #define int long long using namespace std; int mod; int pow(int a,int b) { int result=1; while(b>0) { if(b&1) { result=result*a%mod; } b>>=1; a=a*a%mod; }原创 2022-04-13 21:06:51 · 34 阅读 · 0 评论 -
快速幂c++
int fastPower(int base, int power) { int result = 1; while (power > 0) { if (power & 1) //此处等价于if(power%2==1) { result = result * base % 1000; } power >>= 1;//此处等价于power=power/2 ..原创 2022-04-13 19:32:53 · 689 阅读 · 0 评论 -
欧拉素数打表
/*求小于等于n的素数的个数*/ #include<stdio.h> #include<string.h> using namespace std; int main() { int n, cnt = 0; int prime[100001];//存素数 bool vis[100001];//保证不做素数的倍数 scanf("%d", &n); memset(vis, false, sizeof(vis));//初始化 .原创 2022-04-05 23:18:22 · 43 阅读 · 0 评论 -
set 容器简单操作
set操作原创 2022-03-30 20:07:34 · 404 阅读 · 0 评论