c tips 待续、、、
来源:互联网 发布:msdn win7 优化 编辑:程序博客网 时间:2024/06/14 07:14
1.十六进制形式的输出:
printf("%#x",i); // 加上#有0x的显示。
2.c语言里面的long long
OJ通常使用g++编译器,其64位扩展方式与VC有所不同,它们分别叫做 long long and unsigned long long,处理规模与输入输出相同,扩展比VC好,可以直接使用long long a;定义一个64位的整形,也可使用 scanf("%lld",&a);
printf("%lld",a);
vc 里面用_int64 来定义。
3.c语言动态分配数组长度,读入数据
long *P,*A;
P = (long *)malloc(N*sizeof(long)); // P is the price
A = (long *)malloc(N*sizeof(long)); // A is the amount
for(i = 0; i < N; i++)
{
scanf("%ld %ld",P+i,A+i);
printf("%ld,%ld\n",P[i],A[i]);
}
4.随机数生成时加上随机种子
srand((unsigned)time(0));
5. printf("%p",q); 为打印地址。
6. The C formatting directive "%.2x" indicates that an integer should be printed in hexadecimal with at least two digits.
- c tips 待续、、、
- [未完待续]flask code tips
- C tips
- c++,tips
- C tips
- C tips
- C Tips
- C++语法小tips(未完待续)
- 【C语言】数组--待续
- C++primer笔记待续。。。
- VS2005 tips 问题及解决方法 (未完待续。。。)
- C++代码优化Tips
- tips about C
- C++代码优化Tips
- C/C++ TIPS
- C Programming Tips
- C/C++ Tips (2)
- C学习第一章tips
- 05-php中的全局变量和静态变量
- hdu 4635 Strongly connected (tarjan强连通分量)
- hdu 2895 (水)
- C语言文件输入/输出 ACM改进版(用freopen函数方便检验)
- 浅析.NET
- c tips 待续、、、
- 正则表达式基础知识
- JS图片上传预览
- java学习笔记(一)
- 字节对齐重写malloc 和 free
- poj 1958 Strange Towers of Hanoi
- HDU,3782,xxx定律
- 线性时间查找第k大元素
- Activity---基础总结篇之三:Activity的task相关 .