2012年2月18日

zoj 2988

摘要: /* zoj 2988 */# include <stdio.h># include <string.h>int main(){ int n, i, len; double m; char ch[2]; scanf("%d", &n); i = 0; while (n > 0) { scanf("%lf %s", &m, ch); len = strlen(ch); if(len == 2) { if (ch[0] == 'k') printf(... 阅读全文

posted @ 2012-02-18 22:41 getgoing 阅读(240) 评论(0) 推荐(0) 编辑

zoj 2987

摘要: /* zoj 1987 */# include <stdio.h># include <string.h>int main(){ int T, len, i, k, cnt; char ch[1<<9]; cnt = 0; scanf("%d", &T); while (T > 0) { i = 0; scanf("%d %s", &k, ch); len = strlen(ch); printf("%d ", ++cnt); for (i = 0; i < len; + 阅读全文

posted @ 2012-02-18 22:39 getgoing 阅读(194) 评论(0) 推荐(0) 编辑

zoj 2132 the most frequent number

摘要: the most frequent numberCE: Gcc注释 用/**/MLE: 快排 取中位数/*zoj 2132 the most frequent number quick sort */# include <stdio.h># include <stdlib.h># define MAXN 250005int compare (const void * a, const void * b){ return ( *(int*)a - *(int*)b );}int main(){ int a[MAXN]; int L, i; while (scanf(&qu 阅读全文

posted @ 2012-02-18 21:18 getgoing 阅读(280) 评论(0) 推荐(0) 编辑

csu1022 菜鸟和大牛 dp

摘要: 第一次做dp, 一次就ac了, 体验了一把大牛的感觉。。题目描述:一个由n行数字组成的三角形,第i行有2i-1个正整数(小于等于1000),如下: 3 7 1 4 2 4 3 6 28 5 2 9 3 6 2 要求你用笔从第1行画到第n(0 < n ≤ 100)行,从当前行往下画的时候只能在相邻的数字经过,也就是说,如果从一行的一个数往下画,只能选择其左下或者正下或者右下三个数中的一个(如果存在的话),把所有被画起来的数字相加,得到一个和,求能得到的最大的和的值是多少。上例中能得到的最大的和为3 + 7 + 4 + 9 = 23.// 1022 dp# include <stdio 阅读全文

posted @ 2012-02-18 10:30 getgoing 阅读(328) 评论(0) 推荐(0) 编辑

导航