随笔分类 -  字符串

摘要:Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:N=a[1]+a[2]+a[3]+...+a[m];a[i]>0,1<=m<=N;My question is how man 阅读全文
posted @ 2013-05-26 22:01 萧凡客 阅读(189) 评论(0) 推荐(0) 编辑
摘要:/*在很多软件中,输入拼音的首写字母就可以快速定位到某个词条。比如,在铁路售票软件中,输入: “bj”就可以定位到“北京”。怎样在自己的软件中实现这个功能呢?问题的关键在于:对每个汉字必须能计算出它的拼音首字母。 GB2312汉字编码方式中,一级汉字的3755个是按照拼音顺序排列的。我们可以利用这个特征,对常用汉字求拼音首字母。 GB2312编码方案对每个汉字采用两个字节表示。第一个字节为区号,第二个字节为区中的偏移号。为了能与已有的ASCII编码兼容(中西文混排),区号和偏移编号都从0xA1开始。 我们只要找到拼音a,b,c,...x,y,z 每个字母所对应的GB2... 阅读全文
posted @ 2013-04-16 14:00 萧凡客 阅读(320) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<time.h> 3 #include<string.h> 4 //#include<conio.h> 5 //#include<math.h> 6 //有的注释 是用来测试数据 7 #define N 21 8 int a[10][N+1]; 9 void fun() 10 { 11 int i,temp,j,k,t; 12 memset(a,0,sizeof(a)); 13 for(i=1;i<10;i++) 14 { 15 a[i][0]=1; 16 ... 阅读全文
posted @ 2013-04-14 08:28 萧凡客 阅读(197) 评论(0) 推荐(0) 编辑
摘要:C语言字符串函数大全函数名: stpcpy功能: 拷贝一个字符串到另一个用法: char *stpcpy(char *destin, char *source);程序例:#include <stdio.h>#include <string.h>int main(void){ char string[10]; char *str1 = "abcdefghi"; stpcpy(string, str1); printf("%s\n", string); return 0;}函数名: strcat功能:字符串拼接函数用法: char * 阅读全文
posted @ 2013-04-11 15:15 萧凡客 阅读(173) 评论(0) 推荐(0) 编辑
摘要:sscanf函数sscanf(str+start,"%d%n",&v,&n);2011-05-19 20:56:00|分类:杭电acm|字号订阅 sscanf() - 从一个字符串中读进与指定格式相符的数据.函数原型: Int sscanf( const char *, const char *, ...);int scanf( const char *, ...);头文件: #include<stdio.h>说明: sscanf与scanf类似,都是用于输入的,只是后者以键盘(stdin)为输入源,前者以固定字符串为输入源。 第一个参数可以是一 阅读全文
posted @ 2012-12-13 10:16 萧凡客 阅读(244) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<string.h> 3 4 const int max=120;//字符串大小 5 char x[max],y[max]; 6 int b[max][max]; 7 int c[max][max]; 8 int m,n; 9 10 void printstring(int i,int j)//打印最长字串11 {12 if(i==0||j==0) return;13 if(b[i][j]==1) 14 {15 printstring(i-1,j-1);16 printf("... 阅读全文
posted @ 2012-08-22 08:05 萧凡客 阅读(1676) 评论(0) 推荐(1) 编辑