07 2013 档案

摘要:#include int judge_year(int year){ if(year % 400 == 0 || year % 4 == 0 && year % 100 != 0) return 1; else return 0; }int total_days( int year, int month, int day ){ int i, sum = 0; for(i = 1; i year2) { ... 阅读全文
posted @ 2013-07-31 10:49 心中的阿哲 阅读(177) 评论(0) 推荐(0)
摘要:Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1 2 #include 3 int main() 4 { 5 6 int x, sa[1001], sb[1001], k = 1, i, j, m, n, t, d; 7 char a[1001]... 阅读全文
posted @ 2013-07-29 17:11 心中的阿哲 阅读(211) 评论(0) 推荐(0)
摘要:描述编写一个程序实现将字符串中的所有"you"替换成"we"输入输入包含多行数据 每行数据是一个字符串,长度不超过1000 数据以EOF结束输出对于输入的每一行,输出替换后的字符串样例输入you are what you do样例输出we are what we do分析:一开始,先定义一个字符数组存放字符串,再对其中的字符修改,最后输出。 但这个思路在解决输出格式的问题上比较棘手,所以,换个角度,即如果满足条件直接输出"we".#include int main(){ char s[1000] = {'\0'}; i 阅读全文
posted @ 2013-07-28 21:35 心中的阿哲 阅读(167) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 int main() 4 { 5 6 char color[1000][16]; 7 int n, i, k, j, max, max_i; 8 while( scanf("%d", &n) != EOF && n != 0 ){ 9 // while( n-- ){ #110 /*输入*/11 for( i = 0; i max )37 {38 ... 阅读全文
posted @ 2013-07-28 11:57 心中的阿哲 阅读(186) 评论(0) 推荐(0)
摘要:#include int main(){ char *s = "Welcome!"; while(*s){ putchar(*s); s ++; } putchar('\n'); return 0;} View Code 稍不留神,就出现死循环,原因是循环体里没有趋近循环结束的条件:s ++. 阅读全文
posted @ 2013-07-27 10:05 心中的阿哲 阅读(193) 评论(0) 推荐(0)
摘要:#include int main(){int a, b, m , n, t;while( scanf("%d %d", &a, &b) != EOF ){if( a > b ){t = a;a = b;b = t;}m = n = 0;for( ; a bac过了,但与别人的结果比较,觉得应该有更简短的代码 阅读全文
posted @ 2013-07-26 17:34 心中的阿哲 阅读(153) 评论(0) 推荐(0)
摘要:转化成字符串,再用for循环输出:#include #include int main(){ char s[32]; int d, i; gets(s); d = strlen(s); for( i = 0; i < d; i ++ ) putchar(s[i]); return 0;}疑问:如何进行大数的计算? 阅读全文
posted @ 2013-07-26 16:48 心中的阿哲 阅读(593) 评论(0) 推荐(0)
摘要:你有梦想,放手去做! 阅读全文
posted @ 2013-07-26 15:04 心中的阿哲 阅读(107) 评论(0) 推荐(0)