- 博客(43)
- 收藏
- 关注
转载 2018icpc 徐州h题
题目大意:https://codeforces.com/gym/102012/problem/H?csrf_token=c9d0191a64a241166d54a565b1615125区间[l , r] 中有n条线 问用k种颜色最多能染多少区间 并输出区间和r - l;∑n <= 2e6,1 <= k <= 2e5,0 <= l < r <...
2019-07-19 11:22:00
190
转载 求逆元
及ax=1(modn) 求解x分析有: 原式等价于ax-1=kn, 求解x,y; 及exgcd(x,k) 并且exgcd(x,k)=1 也就是互质时有解;转载于:https://www.cnblogs.com/yzbpxx/p/11185909.html...
2019-07-14 21:40:00
124
转载 取模的n种情况
一 减法 (a-b)%mod=(a%mod-b%mod+n)%mod;二 大数 有乘法取模 可推出 如下代码 string s; cin>>s; int ans=0,len=s.length(); for(int i=0;i<len;i++) ans=((long long )(ans...
2019-07-14 21:32:00
237
转载 Eratos筛法(筛选素数)
对于n以内的非素数必有k*n1=n(n1<n) 所以 可有p1,2p2,3p3把非素数筛选掉实现代码:#include<iostream>#include<string.h>#include<math.h>using namespace std;int main(){ int n; bool vi...
2019-07-14 20:40:00
303
转载 扩展欧几里得
必存在一对整数(x,y) 使得a*x+b*y=gcd(a,b);gcd(a,b)= gcd(b,a%b) (辗转相除法)又 a*x1+b*y1=gcd(a,b)=gcd(b,a%b)=b*x2+(a%b)*y2;又b*x2+(a%b)*y2=b*x2+(a-[a/b]*b)*y2=a*y2-b*(x2-[a/b]*y2);对比系数得 x1=y2,y1=x2-[a/b]*y...
2019-07-14 19:40:00
80
转载 函数库里有三角函数 和反三角函数
acos() cos();转载于:https://www.cnblogs.com/yzbpxx/p/11181858.html
2019-07-13 20:00:00
370
转载 HDU2795线段树入门 简单查询和修改
http://acm.hdu.edu.cn/showproblem.php?pid=2795#include<iostream>using namespace std;const int n=1e6+20;int h,w,x;struct node{ int r; int l; int res;};node t...
2019-07-11 18:56:00
107
转载 快速排序 分析
#include<iostream>using namespace std;void quik_sort(int a[],int l,int r){ if(l<r) { int i=l, j=r, k=a[l]; while(i<j) ...
2019-07-09 20:04:00
190
转载 差分法 (分数比较)
在满足“适用形式”的两个分数中,我们定义分子与分母都比较大的分数叫“大分数”,分子与分母都比较小的分数叫“小分数”,而这两个分数的分子、分母分别做差得到的新的分数我们定义为“差分数”。例如:324/53.1与313/51.7比较大小,其中324/53.1就是“大分数”,313/51.7就是“小分数”,而324-313/53.1-51.7=11/1.4就是“差分数”。“差分法”使用基本...
2019-07-08 15:51:00
5088
转载 ctype.h
isalphaiscntrlisdigitisgraphislowerisuppertolowertoupperisalnumisprintispunctisspaceisxdigitisascii转载于:https://www.cnblogs.com/yzbpxx/p/11143335.html
2019-07-06 17:08:00
120
转载 交错数组
定义: int[][] a = new int[3][]; a[0] = new int[10]; a[1] = new int[5]; Console.Write("{0},{1}", a[0].Length, a[1].Length);不同的行可以分配不同的空间转载于:https://...
2019-07-05 18:14:00
75
转载 hdu 1166 线段树 奇兵布阵
#include<iostream>using namespace std;const int MAX=50000;int tree[(MAX+1)*4];//n个叶子就有2*n-4*n个节点int a[MAX+1];int n;void getup(int root){ return void(tree[root]=tree[root*...
2019-06-22 18:52:00
89
转载 stingstream 类
使用完后在使用必须要clear();转载于:https://www.cnblogs.com/yzbpxx/p/11069929.html
2019-06-22 18:42:00
87
转载 sscanf(char*,char*,,,,) sprintf(char*," ",,,);
从字符串读取格式化输入输入到字符串中转载于:https://www.cnblogs.com/yzbpxx/p/11069899.html
2019-06-22 18:31:00
419
转载 reverse(a.begin(),a.end())
反转容器转载于:https://www.cnblogs.com/yzbpxx/p/11069893.html
2019-06-22 18:29:00
1720
转载 cha[] strrev(char[])
反转字符串 保留在原函数中转载于:https://www.cnblogs.com/yzbpxx/p/11069890.html
2019-06-22 18:28:00
104
转载 线段树入门了解
const int max_n=1<<17;//存储线段树的全局数组int n,dat[2*MAX_n-1];//初始化void init(int n_){ //把元素扩大到2的幂 n=1; while(n<n_)n*=2; //把所有值设为INT_MAX for(itn i=0;i<2*n-1...
2019-06-17 19:30:00
90
转载 求最大严格递增序列
题目链接https://ac.nowcoder.com/acm/contest/911/G#include<iostream>#include<algorithm>using namespace std;int main(){ int a[100000],b[100000],n; cin>>n; ...
2019-06-10 14:40:00
144
转载 素数环
#include<iostream>#include<cmath>#include<cstring>using namespace std;bool prime(int n){ if(n==1) return 0; else for(int i=2;i<=sqrt(n);i++) {if(!(n%i)) r...
2019-06-04 20:46:00
83
转载 全排列函数next_permutation(a,a+n)
#include<iostream>#include<algorithm>using namespace std;int main(){ int a[100]; int n; cin>>n; for(int i=1;i<=n;i++) a[i]=i; sort(...
2019-06-04 19:05:00
442
转载 牛客
bitset<32> b(a);//定义一个二进制类 __builtin_popcount(n) 输出二进制为一的数有多少转载于:https://www.cnblogs.com/yzbpxx/p/10964562.html...
2019-06-02 21:48:00
122
转载 oj.1677矩形嵌套,动态规划 ,贪心
#include<iostream>#include<algorithm>#include<cstring>using namespace std;struct node{ int h,w;}rec[30000];bool cmp(node a,node b){ if(a.h!=b.h) return a...
2019-05-27 20:52:00
228
转载 Dijk入门(杭电2544题)
#include<iostream>#include<cstring>using namespace std;#define INF 0x3f3f3f3fint n,m;int map[105][105];int vis[105];int stemp[105];int dijk(){ memset(vis,0,size...
2019-05-09 22:58:00
225
转载 牛客 19-5-3 QAQ
#include<iostream>#include<cstring>using namespace std;typedef long long LL;int main(){ char a[6000]; scanf("%s",a); LL s1=0,sum=0,len=strlen(a); if(...
2019-05-04 20:44:00
65
转载 BFS入门
#include<iostream>#include<cstring>#include<queue>using namespace std;#define MAX 100#define INF 0x3f3f3f3ftypedef pair<int ,int> P;int sx,sy,gx,gy,n,m;c...
2019-04-28 19:24:00
88
转载 DFS练习
#include<cstdio>#include<iostream>using namespace std;char maze[9][9];int n,m,t,flag;int starti,startj,endi,endj;int dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};void DFS(i...
2019-04-22 21:39:00
83
转载 判断字符串中最长的重复出现的子串
#include<bits/stdc++.h>using namespace std;int main(){ string s; while(cin >> s){ int ls = s.length(); int max1 = 0; for(int i...
2019-04-17 18:22:00
188
转载 输出格式
把一个字符三角形掏空,就能节省材料成本,减轻重量,但关键是为了追求另一种视觉效果。在设计的过程中,需要给出各种花纹的材料和大小尺寸的三角形样板,通过电脑临时做出来,以便看看效果。Input每行包含一个字符和一个整数n(0<n<41),不同的字符表示不同的花纹,整数n表示等腰三角形的高。显然其底边长为2n-1。如果遇到@字符,则表示所做出来的样板三角形已经够了。...
2019-04-07 20:49:00
160
转载 初步认识,合并集(树)
#include<stdio.h>#include<iostream>#include<string.h>#include<math.h>#include<algorithm>using namespace std;int fx,fy,a[1001]={0};int find(int x){ ...
2019-03-26 20:07:00
120
转载 杭电1003题
#include<stdio.h>#include<iostream>#include<string.h>#include<math.h>#include<algorithm>using namespace std;int max_i=0,min_i=0,ma=0;void max_son(int...
2019-03-25 15:39:00
182
转载 背包问题(递归的使用)
#include<stdio.h>#include<iostream>#include<algorithm>using namespace std;int knap(int W[],int T,int n){ if(T==0) return 1; if(T<0||(T>0&&n<...
2019-03-16 19:14:00
143
转载 oj1089-1096总结(输入输出练习)
//无限输出类#include<stdio.h>int main(void){int a,b;while((scanf("%d %d",&a,&b))!=EOF) //留意这种形式 printf("%d\n",a+b); return 0;}//规定t行类#include<stdio.h>int main(...
2019-01-31 14:15:00
141
转载 oj 1002题 (大数题)
#include <stdio.h>#include <string.h>int main(void){ int q,j,h,k,l; int d; char s1[1001],s2[1001];//题目要求位数不大于1000 scanf("%d",&h); for(l=1;l<=h...
2019-01-29 21:09:00
161
转载 第五次博客园作业+
7-2判断单词个数:#include<stdio.h>int main(void){ int flag=1,count=0; char c; while((c=getchar())!='\n'){ if(c=='\n') continue; if(c==' '){ if...
2018-12-23 11:07:00
88
转载 第五次博客园作业-
一设计思路1:利用flag判断前者是否为连续空格;2:结束时也同样用flag判断是否最后一个为单词;二流程图:三遇到的错误及解决办法:这是逻辑错误,题目要求用换行符结束,我用的是点号结束。7-3交换最大最小值:#include<stdio.h>int main(){ int a[80],i,n,max,min,x,m;...
2018-12-23 09:46:00
126
转载 博客园第四次作业
7-2打印九九乘法口诀表:#include<stdio.h>int main(void){ int i,k,n; scanf("%d",&n); for(i=1;i<=n;i++){ for(k=1;k<=i;k++) printf("%d*%d=%-4d...
2018-12-16 15:16:00
110
转载 博客园第四次作业
7-2打印水仙花数:#include<stdio.h>int main(void){ int i,k,n; scanf("%d",&n); for(i=1;i<=n;i++){ for(k=1;k<=i;k++) printf("%d*%d=%-4d",k,i,...
2018-12-15 11:41:00
84
转载 C语言第三次作业
题目7-2统计素数并求和:#include<stdio.h>int main(void){ int k,n,count=0,i,sum=0; scanf("%d%d",&k,&n); for(;k<=n;k++) { for(i=2;i<=k-1;i++){ ...
2018-12-09 11:02:00
83
转载 c语言第三次作业
题目7-1找出最小值:#include<stdio.h>int main(){ int min,i,n,count; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&count); if(i==1)min=count; if(count&...
2018-12-08 09:13:00
127
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人