Chri_K

09 2020 档案

负进制转换(noip2000)
摘要:#include<iostream>#include<cstdio>#include<cmath>#include<cstring>using namespace std;void change(int n,int r){ if(n==0) return ; int m=n%r; if(m<0) m 阅读全文

posted @ 2020-09-30 23:01 Chri_K 阅读(120) 评论(0) 推荐(0)

数制转换noip1996
摘要:#include<iostream> using namespace std; int a,b,c,i,m,k,f[1001]; char x,y; int sum(int p,int q) { int s=1; for(int j=1;j<=q;j++) { s*=p; } return s; } 阅读全文

posted @ 2020-09-30 16:13 Chri_K 阅读(150) 评论(0) 推荐(0)

曹冲养猪(crt)
摘要://中国剩余定理 //我的70分代码=_= #include <iostream> #include<algorithm> using namespace std; typedef long long ll; ll exgcd(ll a,ll b,ll &x,ll &y) { if(!b) { x 阅读全文

posted @ 2020-09-30 13:50 Chri_K 阅读(191) 评论(0) 推荐(0)

康熙的难题(exgcd,洛谷P1516 青蛙的约会)
摘要:x+km≡y+kn(modl) x+km−(y+kn)=lz,z∈Z x−y+k(m−n)−lz=0 k(m-n)-lz=-(x-y) 设S=x-y,W=n-m kW+lz=S(exgcd,求k) //我的代码 #include<iostream>#define ll long long using 阅读全文

posted @ 2020-09-29 19:42 Chri_K 阅读(166) 评论(0) 推荐(0)

noip2012同余(扩展欧几里得定理)
摘要:实质是 ax + by = 1; gcd(a,b)=gcd(b,a mod b) 欧几里得算法; //我的代码 #include <iostream> using namespace std;long long a,b,x,y,k;void exgcd(long long a,long long b 阅读全文

posted @ 2020-09-29 17:09 Chri_K 阅读(129) 评论(0) 推荐(0)

欧拉函数
摘要:公式:φ(N)=N(1-1/p1)(1-1/p2)...(1-1/pn)(p1,p2...pn为N的除一以外的质因数) //我的代码 #include<iostream>using namespace std;int main(){ int n; cin >> n; int sum=n; for(i 阅读全文

posted @ 2020-09-29 12:21 Chri_K 阅读(144) 评论(0) 推荐(0)

P3912 素数个数
摘要:#include <cstring> #include <iostream>using namespace std; bool isPrime[100000010]; int sum, primes[100000010]; int main(){ int n; cin>>n; memset(isPr 阅读全文

posted @ 2020-09-29 10:44 Chri_K 阅读(123) 评论(0) 推荐(0)

noip2012d1t1(Vigenère 密码 )
摘要:#include<iostream>#include<cstring>#include<cstdio>using namespace std;char c[2100],k[2100]; int n[2100],lenk; int main(){ cin>>k; cin>>c; lenk=strlen 阅读全文

posted @ 2020-09-19 15:43 Chri_K 阅读(85) 评论(0) 推荐(0)

noip2013d1t1(转圈游戏)
摘要://快速幂 #include<iostream>#include<cstdio>using namespace std;int n,m,x;long long k;int ans=1;int fstpow(int a,long long b){ while(b>0) { if(b%2==1) { a 阅读全文

posted @ 2020-09-18 15:54 Chri_K 阅读(195) 评论(0) 推荐(0)

noip2014d1t1(生活大爆炸版石头剪刀布)
摘要:#include<iostream>using namespace std;int n,a1,b1,xa,xb;int a[210],b[210];int mac[5][5]={{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}}; 阅读全文

posted @ 2020-09-18 11:56 Chri_K 阅读(116) 评论(0) 推荐(0)

noip2017d1t1(小凯的疑惑)
摘要://同余方程 #include<iostream>#include<cstdio>using namespace std;int main(){ long long a,b,x; cin>>a>>b; x=a*b-a-b; cout<<x<<endl; return 0;} 阅读全文

posted @ 2020-09-18 09:50 Chri_K 阅读(129) 评论(0) 推荐(0)

noip2015d1t1(神奇的幻方)
摘要:#include<iostream>#include<cmath>using namespace std;int n;int a[40][40];int main(){ cin>>n; int k=n*n; int mid=(n+1)/2; a[1][mid]=1; int x=1,y=mid; f 阅读全文

posted @ 2020-09-17 11:18 Chri_K 阅读(151) 评论(0) 推荐(0)

noip2016d1t1(玩具谜题)
摘要:#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ string a[100001]; int b[100001],q[100001],w[100001]; int m,n,k=1; c 阅读全文

posted @ 2020-09-17 10:02 Chri_K 阅读(141) 评论(0) 推荐(0)

noip2018d1t1(铺设道路)
摘要:#include<iostream>using namespace std;int n,a[100005];long long ans=0;int main(){ a[0]={0}; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i 阅读全文

posted @ 2020-09-16 12:07 Chri_K 阅读(113) 评论(0) 推荐(0)

csp2019d1t1
摘要:#include<iostream>#include<cstdio>#include<cmath>using namespace std;#define ull unsigned long longull a[70];int main() { for(int i=0;i<=64;i++) { a[i 阅读全文

posted @ 2020-09-16 12:06 Chri_K 阅读(129) 评论(0) 推荐(0)

P1007(洛谷过了,内网不过。。。)
摘要:#include<stdio.h>int main(){ int i,A[1005]={0},B[1005]={0},n,j; scanf("%d", &n); A[0]=B[0]=1; for (i=2;i<=n;i++){ for (j=0;j<100;j++) B[j]*=i; for (j= 阅读全文

posted @ 2020-09-12 10:35 Chri_K 阅读(133) 评论(0) 推荐(0)

P1067
摘要://类似冒泡排序 #include<iostream>#include<cstring>using namespace std;int main(){ int n; cin>>n; string a[30]; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int 阅读全文

posted @ 2020-09-10 08:28 Chri_K 阅读(115) 评论(0) 推荐(0)

P1102-P1103
摘要://01背包 // #include <iostream>// #include <algorithm>// using namespace std;// int tim[101];// int val[101];// int f[1001];// int main()// {// int t,m; 阅读全文

posted @ 2020-09-09 17:58 Chri_K 阅读(134) 评论(0) 推荐(0)

P1091,P1017
摘要://01背包 #include <cstdio> #include <algorithm> using namespace std; int v,n,tj[30],dp[21000],maxn; int main() { scanf("%d%d",&v,&n); for (int i = 1;i < 阅读全文

posted @ 2020-09-09 17:51 Chri_K 阅读(161) 评论(0) 推荐(0)

P1097-P1099
摘要://01背包 #include<iostream> using namespace std; int main() { int v,n; cin>>v>>n; int w,c; int dp[1010]; for(int i=1;i<=n;i++) { cin>>w>>c; for(int j=v; 阅读全文

posted @ 2020-09-09 17:49 Chri_K 阅读(174) 评论(0) 推荐(0)

P1082
摘要://思路问题,可以把翻转N-1枚硬币转换为只翻转一枚硬币 #include<iostream> using namespace std; int main() { int n; cin>>n; cout<<n<<endl;//找规律直接输出 int coin[101]; for(int i=1;i< 阅读全文

posted @ 2020-09-09 17:40 Chri_K 阅读(123) 评论(0) 推荐(0)

P1029-P1030
摘要:#include<iostream> #include<algorithm> using namespace std; int main() { int n; cin>>n; int a[101]; int b[101]; int rest=0; int i; a[0]={0}; for(int i 阅读全文

posted @ 2020-09-09 17:36 Chri_K 阅读(81) 评论(0) 推荐(0)

P1032-P1039
摘要:#include<iostream> #include<algorithm> using namespace std; int main() { int n,k; cin>>n>>k; int a[10001]; for(int i=1;i<=n;i++) { cin>>a[i]; } sort(a 阅读全文

posted @ 2020-09-08 19:17 Chri_K 阅读(117) 评论(0) 推荐(0)

P1018-P1020
摘要:#include<iostream> #include<cmath> using namespace std; int main() { int n; cin>>n; int sum=0; for(int i=2;i<=sqrt(n);i++) { if(n%i==0) { sum++; } } i 阅读全文

posted @ 2020-09-08 19:14 Chri_K 阅读(110) 评论(0) 推荐(0)

P1004-1006
摘要:#include<iostream> using namespace std; int main() { int L,M; cin>>L>>M; int st,en; int tree[10001]; int sum=0; for(int i=0;i<=L;i++) { tree[i]={0}; } 阅读全文

posted @ 2020-09-08 10:24 Chri_K 阅读(83) 评论(0) 推荐(0)

P1000-1003
摘要:#include <iostream>using namespace std;int main(){ int a,b; cin>>a>>b; cout<<a+b<<endl; return 0;} #include <iostream> using namespace std; int main() 阅读全文

posted @ 2020-09-08 10:20 Chri_K 阅读(111) 评论(0) 推荐(0)