- 博客(17)
- 收藏
- 关注
原创 nn矩阵行列式mod p
(伪模板代码高斯消元)#include<iostream>#include<algorithm>#include<string.h>#include<math.h>using namespace std;typedef long long ll;const int N=510;int n;ll m, s[N][N], ans=1;void grd(int a,int b,int c){ if(s[b][c]!=0) { long
2021-04-18 15:03:41
353
2
原创 米勒拉宾素性检验(代码模板)
typedef long long ll;ll qpow(ll a, ll n, ll p) // 快速幂{ ll ans = 1; while (n) { if (n & 1) ans = (__int128)ans * a % p; // 注意!中间结果可能溢出,需要使用__int128过渡 a = (__int128)a * a % p; n >>= 1; } re.
2021-04-17 21:56:40
517
1
原创 Educational Codeforces Round 106 (Rated for Div. 2)——B、C
B. Binary Removalscode:#include <string>#include <string.h>#include <math.h>#include<algorithm>#include <iostream>#include<utility>using namespace std;typedef long long ll;int main(){ cin.tie(0);std::ios::s
2021-03-31 23:28:09
102
原创 Codeforces Round #708 (Div. 2)——A~E1
A. Meximizationcode:#include <string.h>#include<algorithm>#include <iostream>#include<utility>using namespace std;typedef long long ll;typedef pair<int, int> pp;const int maxn=5e6+10;int main(){ cin.tie(0);std::io
2021-03-24 22:13:29
116
原创 Codeforces Round #707 (Div. 2——A~C
A. Alexey and TrainExampleinput222 410 120 251 47 89 1013 1519 201 2 3 4 5output1232code:#include <string.h>#include <math.h>#include<algorithm>#include <iostream>#include<iomanip>using namespace std;
2021-03-19 17:06:27
105
原创 Codeforces Round #706 (Div. 2)——A~D
A. Split it!Exampleinput75 1qwqwq2 1ab3 1ioi4 2icpc22 0dokidokiliteratureclub19 8imteamshanghaialice6 3aaaaaaoutputYESNOYESNOYESNONO题解:注意:1、k=0时,s即为a[1]2、不需要讨论n的奇偶性,只需要判断n为偶数时是否有2*k==n3、镜像串的判断不需要循环到n/2,只用循环到k,因为中间的k~n-k可作为a[k
2021-03-18 15:02:58
112
原创 Codeforces Round #705 (Div. 2)——A~C
A. Anti-knapsackExampleinput33 25 31 1output23 134 5 20code:#include <string.h>#include <math.h>#include<algorithm>#include <iostream>using namespace std;typedef long long ll;int main(){ cin.tie(0);std::ios
2021-03-15 23:36:08
110
原创 Educational Codeforces Round 105 (Rated for Div. 2)——A、B
A. ABC StringExampleinput4AABBACCACABBBBACABCAoutputYESYESNONOCODE:#include <string>#include<algorithm>#include <iostream>#include <map>using namespace std;typedef long long ll;int main(){ int t; cin>&
2021-03-14 23:25:10
77
原创 Codeforces Global Round 13——A~D
A. K-th Largest ValueExampleinput5 51 1 0 1 02 31 22 32 12 5output1010AC代码:#include <string.h>#include<algorithm>#include <iostream>using namespace std;typedef long long ll;int main(){ cin.tie(0);std::ios::sync
2021-03-14 14:23:39
127
原创 Codeforces Round #704 (Div. 2)——A~D
A. Three swimmersThree swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly ???? minutes to swim across the entire pool and come back, exactly ???? minu
2021-03-08 23:16:48
77
原创 Codeforces Round #703 (Div. 2)——B、D
B. Eastern ExhibitionYou and your friends live in ???? houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the buil
2021-03-05 11:41:39
102
原创 Educational Codeforces Round 103 (Rated for Div. 2)——A~D
A. K-divisible SumYou should create an array of ???? positive integers ????1,????2,…,???????? such that the sum (????1+????2+⋯+????????) is divisible by ???? and maximum element in ???? is minimum possible.What is the minimum possible maximum element in
2021-03-02 01:06:08
193
原创 Codeforces Round #702 (Div. 3)——C、D
C. Sum of CubesYou are given a positive integer ????. Check whether the number ???? is representable as the sum of the cubes of two positive integers.Formally, you need to check if there are two integers ???? and ???? (1≤????,????) such that ????3+????3=
2021-02-20 22:54:54
179
2
原创 Codeforces Round #698 (Div. 2)——C、D
C. Nezzar and Symmetric ArrayLong time ago there was a symmetric array ????1,????2,…,????2???? consisting of 2???? distinct integers. Array ????1,????2,…,????2???? is called symmetric if for each integer 1≤????≤2????, there exists an integer 1≤????≤2????
2021-02-20 20:28:09
156
原创 Codeforces Round #697 (Div. 3)——C~G
C. Ball in Berlandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a
2021-01-26 19:40:22
279
原创 2021-01-19-cf-Div. 2-签到题
B. Different Divisorstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPositive integer ???? is called divisor of positive integer ????, if ???? is divisible by ???? without remainder. For example, 1
2021-01-20 14:50:02
100
原创 菜鸟新人的第一篇博客——关于快速幂
(主要是写给自己看,加深理解顺便记录)求 a 的 b 次方对 p 取模的值输入格式三个整数 a,b,p ,在同一行用空格隔开。输出格式输出一个整数,表示a^b mod p的值。数据范围1≤a,b,p≤10^9时/空限制: 1s / 32MB输入样例:3 2 7输出样例:2解题思路:1、取模运算的性质:(ab)%p=[(a%p)(b%p)]%p证明:设a = k1 * p + q1 b = k2 * p + q2a * b = ( k1 * k2 * p + k1 *
2021-01-16 15:39:39
136
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人