2012年12月11日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1093Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of inpu 阅读全文
posted @ 2012-12-11 16:27 猿人谷 阅读(423) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1092Problem DescriptionYour task is to Calculate the sum of some integers.InputInput contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this tes 阅读全文
posted @ 2012-12-11 16:25 猿人谷 阅读(331) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1091Problem DescriptionYour task is to Calculate a + b.InputInput contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be 阅读全文
posted @ 2012-12-11 16:23 猿人谷 阅读(449) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1090Problem DescriptionYour task is to Calculate a + b.InputInput contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of i 阅读全文
posted @ 2012-12-11 16:21 猿人谷 阅读(547) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1089Problem DescriptionYour task is to Calculate a + b.Too easy?! Of course! I specially designed the problem for acm beginners.You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim. 阅读全文
posted @ 2012-12-11 16:20 猿人谷 阅读(460) 评论(0) 推荐(0) 编辑
摘要: 一、时间类型。Linux下常用的时间类型有4个:time_t,struct timeb, struct timeval,struct timespec,clock_t, struct tm.(1) time_t是一个长整型,一般用来表示用1970年以来的秒数.该类型定义在<sys/time.h>中.一般通过 time_t time = time(NULL); 获取.(2) struct timeb结构: 主要有两个成员, 一个是秒, 另一个是毫秒, 精确度为毫秒.1 struct timeb2 {3 time_t time;4 unsigned short millitm;5 .. 阅读全文
posted @ 2012-12-11 15:37 猿人谷 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 前阵子接触到一道关于数组内部链表(多用于内存池技术)的数据结构的题, 这种数据结构能够比普通链表在cache中更容易命中, 理由很简单, 就是因为其在地址上是连续的(=.=!), 借这个机会, 就对cpu cache进行了一个研究, 今天做一个简单的分享, 首先先来普及一下cpu cache的知识, 这里的cache是指cpu的高速缓存. 在我们程序员看来,缓存是一个透明部件. 因此, 程序员通常无法直接干预对缓存的操作. 但是, 确实可以根据缓存的特点对程序代码实施特定优化, 从而更好地利用高速缓存.高速缓存的置换策略会尽可能地将 访问频繁的数据放入cache中, 这是一个动态的过程, 所以 阅读全文
posted @ 2012-12-11 15:32 猿人谷 阅读(847) 评论(0) 推荐(0) 编辑
摘要: 在头文件<ctype.h>中定义了一些测试字符的函数。在这些函数中,每个函数的参数都是整型int,而每个参数的值或者为EOF,或者为char类型的字符。<ctype.h>中定义的标准函数列表如下:函数定义函数功能简介int isalnum(int c)检查字符是否是字母或数字int isalpha(int c)检查字符是否是字母int isascii(int c)检查字符是否是ASCII码int iscntrl(int c)检查字符是否是控制字符int isdigit(int c)检查字符是否是数字字符int isgraph(int c)检查字符是否是可打印字符int 阅读全文
posted @ 2012-12-11 13:39 猿人谷 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 1. overload 仅仅返回值类型不同的函数不能被重载.2. 所谓私有,是指该成员只能被类本身的方法访问----即使是这个类的对象也不能直接访问.3. 类的对象所占用的空间是其成员变量所用内存的总和(可sizeof求证),对象指针指向其首个成员变量地址.对象的函数不占用对象的内存空间(即使函数中有局部变量)4. const关键字的主要作用是利用编译程序进行排错.和限制对成员的改变.表现在以下方面:(1)const成员函数:const位于形参括号之后,分号之前.该函数不能修改成员变量.(2)const类:对一个类说明使用了const,实际上是说明了一个const型的this指针,该指针只能调 阅读全文
posted @ 2012-12-11 13:31 猿人谷 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 题目:输入某年某月某日,判断这一天是这一年的第几天?1.程序分析:以3月5日为例,应该先把前两个月的加起来,然后再加上5天即本年的第几天,特殊 情况,闰年且输入月份大于3时需考虑多加一天。2.程序源代码: 1 #include<stdio.h> 2 int main() 3 { 4 int day,month,year,sum,leap; 5 printf("\nplease input year,month,day\n"); 6 scanf("%d,%d,%d",&year,&month,&day); 7 switc 阅读全文
posted @ 2012-12-11 13:26 猿人谷 阅读(1982) 评论(0) 推荐(1) 编辑