- 博客(8)
- 收藏
- 关注
转载 例题3-5生成元
#include<iostream>#include<cstring>#include<cmath>#include<cstdio>#include<cstdlib>#include<algorithm>#include<ctime>using namespace std;const int maxn=10005;int ans[maxn0];int main(){ i
2017-12-19 20:22:30 759
转载 竖式问题
#include<iostream>#include<cstring>#include<cmath>#include<cstdio>#include<cstdlib>#include<algorithm>#include<ctime>using namespace std;int main(){ int count=0; char buf[99],s[20];
2017-12-19 16:36:45 134
转载 例题3-3回文词镜像词
#include<cstring>#include<cmath>#include<cstdio>#include<cstdlib>#include<algorithm>#include<ctime>#include<ctype.h>using namespace std;const char* rev="A 3 HIL JM O 2TUVWXY51SE Z 8";con
2017-12-19 16:21:52 226
转载 习题2-6排列
用1,2,3,…,9组成3个三位数abc, def和ghi,每个数字恰好使用一次,要求abc:def:ghi = 1:2:3。按照”abc def ghi”的格式输出所有解,每行一个解。提示:不必太动脑筋。#include <stdio.h>#include <string.h>int main(){ int x,y,z,a[10],i,s; memset(a,0,sizeof
2017-12-15 15:28:16 612
转载 习题2-5分数化小数
此题的关键之处在于小数部分使用余数得出。#include<iostream>#include<cstring>#include<cmath>#include<cstdio>#include<cstdlib>#include<algorithm>#include<ctime>using namespace std;int main(){ int a,b,c,n=1;
2017-12-15 15:25:59 265
转载 习题2-4子序列的和
此题的陷阱在于越界:int极限 sqrt(2^31)=sqrt(2)2^15=1.414*32*1024 故655360明显越界;long long 极限sqrt(2^63)=sqrt(2)2^31=1.414*2*1024*1024*1024,故655360还在long long 范围之内。#include<iostream>#include<cstring>#include<cmath>#
2017-12-15 15:24:16 215
原创 习题2-3
倒三角形 输入正整数输出n层的倒三角形#include<stdio.h>int main(){ int n; scanf("%d\n",&n); for(int i=n;i>=1;i--) { for(int j=1;j<=n-i;j++) printf(" "); for(
2017-12-15 15:19:27 206
原创 算法竞赛习题2-1水仙花数
问: 输出100-999中所有的水仙花数,若三位数ABC满足ABC=A3+B3+C3,则称其为水仙花数。代码块include
2017-12-15 15:10:59 457
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人