zrq495
www.zrq495.com
摘要: 第一次RE,数组定义的太小了,题目说是5000个单词,如果加上重复的就不够了。第二次TLE,我用的是选择排序,应该用快排。快排函数:用 法: void qsort(void *base, int nelem, int width, int (*fcmp)(const void *,const void *)); 参数:1 待排序数组首地址 2 数组中待排序元素数量 3 各元素的占用空间大小 4 指向函数的指针,用于确定排序的顺序 qsort 的函数原型是void __cdecl qsort ( void *base, size_t num, size_t width, int (__... 阅读全文
posted @ 2012-05-31 20:47 zrq495 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 开始的时候没看懂,然后看到空格和o时就想到了——很久很久以前输入指令要:打孔。然后就简单了。。。这也是我在UVa上见到的题目最短的题了。。。代码如下: 1 #include<stdio.h> 2 #include<string.h> 3 int a[11]={0, 128,64,32,16,8,0,4,2,1}; 4 int main() 5 { 6 int i, n, b; 7 char str[20]; 8 while(gets(str)) 9 {10 if (str[0] != '|')11 continue;12 ... 阅读全文
posted @ 2012-05-31 18:26 zrq495 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 1A,呵呵。注意不区分大小写,如果单词重复也要算的,还有单词要合法,就是哲句话“A keyword ``occurs" in an excuse if and only if it exists in the string in contiguous form and is delimited by the beginning or end of the line or any non-alphabetic character or a space.”代码如下: 1 #include<stdio.h> 2 #include<string.h> 3 4 char 阅读全文
posted @ 2012-05-31 17:17 zrq495 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 题很简单,但是由于粗心,导致各种纠结,WA了N多次。。。。。AC代码如下: 1 #include<stdio.h> 2 #include<string.h> 3 4 void func(char str[]) 5 { 6 int len, i, j, con, dot, n; 7 double value[100], sum; 8 char s[100]; 9 len=strlen(str);10 memset(value, 0, sizeof(value));11 for (i=0; i<len; i++)12 {13 ... 阅读全文
posted @ 2012-05-31 15:58 zrq495 阅读(195) 评论(0) 推荐(0) 编辑