- 博客(11)
- 收藏
- 关注
原创 模板大全
【注意数据范围】大数用__int64 a;(横线是两行)printf(“%I64d”,a);【memset函数】头文件#include给数组快速赋值,值一般是0,-1格式:int a[N];memset(a,0,sizeof(a));将数组a中所有元素赋为0.(二维数组也可以) 【素数筛选法】#define N 10000000int f[N+1
2015-12-06 19:45:23 242
原创 C语言不同进制的定义、输入、输出
# include int main (){ __int64 p;//64位数的定义 scanf("%I64d",&p);//64位数的输入 printf("%I64d",p); int n=0x00,m=0x0,sum=0x0;//十六进制数的定义,通过在定义前加上0x00进行定义 int a=00,b=00; //八
2015-12-01 21:22:40 601
原创 bjfu oj 1011 将浮点数转换为分数相除的形式
http://acm.bjfu.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1011被编译器坑的我眼泪流下来,,VC6.0为毛不支持long long !!!!!!!!!!!!!!!!!!!!!!该重装系统换成visual studio了解题思路:输入分成两种情况进行运算(1)有限小数
2015-11-26 18:31:04 276
原创 bjfu 1008
http://acm.bjfu.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1008这是个坑,,开始自己想的有问题,sum应该是换为64位的存储,作用应该是防止输入的数过多超出32位的范围,开始的时候疏忽了。。。。。# include int main (){ __int64t;
2015-11-25 14:16:21 398
原创 大整数类的应用 bjfu1005
写了一上午,,,哦哦哦!http://acm.bjfu.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1005通过字符串进行N的阶乘的运算,从0位置开始,若有进位,将答案长度加上1。并且对后面的按照进位进行赋值。# include # include # include char a[1000
2015-11-25 13:07:40 316
原创 gets()函数的应用
gets():作用为录入字符串,与scanf("%s")不同的是它是以换行符为记号区分字符串是否录入结束的,而scanf是以换行和空格区分字符串是否录入结束的。
2015-11-12 18:30:01 452
原创 hdoj练习题 异或的应用
Problem DescriptionIn the new year party, everybody will get a "special present".Now it's your turn to get your special present, a lot of presents now putting on the desk, and only one of them will
2015-11-12 16:21:24 276
原创 HDOJ 练习题 memset 和malloc 函数的用法
memset 快速赋值malloc 分配内存空间代码举例:# include # include # include int main (){ int n; while (scanf("%d",&n)!=EOF) { int *a; a=(int *)malloc(n*sizeof(int)); memset(a,0,n*sizeof(in
2015-11-09 20:43:40 328
原创 hdoj 练习题1.2.2 字符串反转
Problem DescriptionIgnatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them.Input
2015-11-09 19:59:59 341
原创 16进制数的定义以及输入输出
HDOJ练习题16进制数的定义以及输入输出!!!!!!!!!!!!!!!!!!!!! # include int main (){ int a=0x00,b=0x00; while (scanf("%x %x",&a,&b)!=EOF) { printf("%d\n",a+b); } return 0;}
2015-11-09 17:42:28 915
原创 大整数类应用小结
hdoj已做题目 1042 1042 1047 解题思路:通过定义字符串来完成大整数类的加减乘除,直接输出字符串来完成输出结果。 将输入的字符串转化为数字进行运算然后再输出到字符串注意字符串的翻转以及较短的字符串优先结束运算然后对较长的单独运算 进位注意源代码:# include # include using namespace std;char * ad
2015-11-09 16:04:47 339
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人