- 博客(12)
- 收藏
- 关注
转载 lg 1478
好多天没碰代码了,感觉忘得差不多了,没有学习感觉罪恶深重,从今天起开始补题啊啊! 简单零一背包,套模板就行。 #include<bits/stdc++.h> using namespace std; int w[10000]; int dp[10000]; int main() { int n,a,b,s; cin>>n>...
2019-09-07 15:31:00
166
转载 素数判定
int isprime(int n) { if(n<=3) return n>1; int k; k=sqrt(n); if(n%6!= 1 && n%6!=5) return 0; for(int i=5;i<=k;i+=6) { if(n%i==...
2019-09-02 20:26:00
148
转载 Find a multiple
The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000. This numbers are not necessarily different (so it may happen that t...
2019-08-15 22:48:00
166
转载 C - Co-prime
Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N.Two integers are said to be co-prime or relatively prime if they have no...
2019-08-15 22:29:00
247
转载 B - How many integers can you find
Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-in...
2019-08-15 22:02:00
205
转载 A/B
要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 模板题,现在给你模板: exgcd逆元: //x->a关于b的逆元 //y->b关于a的逆元 typedef long long LL void ex_gcd(LL a, LL b, LL &x, LL &y...
2019-08-14 22:32:00
102
转载 Problem A
度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到:H(s)=∏i≤len(s)i=1(Si−28)(mod9973)H(s)=∏i=1i≤len(s)(Si−28)(mod9973)SiSi代表 S[i] 字符的 AS...
2019-08-14 22:11:00
166
转载 算数基本原理-模板
#include<stdio.h> #include<algorithm> #include<map> using namespace std; int a[1000]; map<int,int>ma; int main() { int n; int num=0; scanf("%d",&a...
2019-08-12 21:24:00
189
转载 Closest Common Ancestors (Lca,tarjan)
午时刷题,难甚,遂小憩于桌上,惊醒,于梦中有所得,虽大声曰:吾已得tarjan之奥秘! 关于tarjan算法,其实就是一个递归加并查集的应用。 大致代码: #include<bits/stdc++.h> using namespace std; int find(int x){ .... } void join(int x,int...
2019-08-08 23:33:00
199
转载 poj 1611
1611:The Suspects 总时间限制:1000ms内存限制:65536kB描述Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To ...
2019-08-05 20:36:00
123
转载 hdu--1232 继续通畅工程
wa了8次,超级崩溃,险些自闭,不过倒是学到了很多,先来一段代码: #include<bits/stdc++.h> using namespace std; int p[1000]; //储存查并集 int n,m; struct node{ //数组结构体,排序距离 int a,b; in...
2019-08-05 13:07:00
163
转载 GCD&&素筛&&快速幂 --A - Pseudoprime numbers
Fermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not very...
2019-07-24 22:59:00
111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅