《刘汝佳算法竞赛入门经典》第五章 排序检索

《刘汝佳算法竞赛入门经典》第五章 排序检索的相关文章

刘汝佳算法竞赛入门经典 第四单元习题答案自编

第四章小问题集锦 以上是我这一章课后题思考的流程,有错误和不严谨地方请直接指出! 1.解方程组 任务一:使用assert宏,解不唯一时异常退出 #include <stdio.h> //x=(ce-bf)/(ae-bd), y=(cd-af)/(bd-ae) int solve(double a, double b, double c, double d, double e, double f){ assert(a*e != b*d); ... } int main(){ double a,b

《刘汝佳算法竞赛入门经典》第五章 高精度

Integer Inquiry 输入几行大整数, 求他们的和吗以0表示输入结束

《刘汝佳算法竞赛入门经典》第五章 数论

Skew Binary 斜二进制 斜二进制的每位为0, 或 1, 最低位可以为2. 第k位的...代表 2k+1 -1,给出一个斜二进制数,把他转换成十进制数.正常模拟就好 1 #include <cstdio> 2 #include <cstring> 3 char A[1000]; 4 5 int main() { 6 while (scanf("%s", A) != EOF) { 7 if (A[0] == '0') break; 8 int len =

《刘汝佳算法竞赛入门经典》 第五章 字符串

Palindromes 几个if语句判断一下就好了

《刘汝佳算法竞赛入门经典》第五章 简单几何计算

The Other Two Trees 另两棵树 没看懂题目,搜了下题解,都是直接给出了简化后的题意和解法...自己再读读原题意吧

刘汝佳算法竞赛入门经典 第二单元习题答案自编

欢迎交流讨论! @2-1 #include <fstream> using namespace std; ifstream fin("aplusb.in"); ofstream fout("aplusb.out"); int main(){ int n; while(fin>>n){ int count = 0; //计算位数 while(n){ count++; n /= 10; } fout << count <<

算法竞赛入门经典_第二章:循环结构程序设计_上机练习_MyAnswer

习题2-1 位数 输入一个不超过109的正整数,输出它的位数.例如12735的位数是5.请不要使用任何数学函数,只用四则运算和循环语句实现. #include<stdio.h> int main(void) { int n; int digit = 0; scanf("%d",&n); while(n) { n = n / 10; digit++; } printf("%d\n", digit); return 0; } 习题2-2 水仙花数 输

《算法竞赛入门经典》第一章1.4

代码1-11 1 #include<stdio.h> 2 int main() 3 { 4 int a,b,n,m; 5 scanf("%d%d",&n,&m); 6 a=(4*n-m)/2; 7 b=n-a; 8 if(n%2==1||a<0||b<0) 9 printf("No answer\n"); 10 else 11 printf("%d %d",a,b); 12 return 0; 13 } 程

《算法竞赛入门经典》第二章 2.1

程序2-1 1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 for(int i=1;i<=n;i++) 8 { 9 printf("%d\n",i); 10 } 11 return 0; 12 13 } 程序2-2 1 #include<stdio.h> 2 #include<math.h&