随笔分类 -  字符串处理

摘要:View Code 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 5 public class Hdu1063{//提交时名字改为Main 6 public static void main(String args[]){ 7 int n; 8 BigDecimal R,res; 9 String str;10 Scanner cin = new Scanner(System.in);11 12 while(cin.hasNext()){13 ... 阅读全文
posted @ 2012-09-04 19:23 zhongya 阅读(354) 评论(0) 推荐(0)
摘要:View Code 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 5 public class Hdu1047{提交时要改为Main 6 public static void main(String args[]){ 7 int n, flag=0; 8 BigInteger a, sum; 9 10 Scanner cin = new Scanner (System.in);11 n = cin.nextInt();12 13 for(int ... 阅读全文
posted @ 2012-09-04 19:22 zhongya 阅读(149) 评论(0) 推荐(0)
摘要:View Code 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 5 public class Main{ 6 public static void main(String args[]){ 7 BigInteger f[] = new BigInteger[1005]; 8 int n, p; 9 Scanner cin = new Scanner(System.in);10 f[1] = BigInteger.valueOf(1);11 f[2] = BigInteg... 阅读全文
posted @ 2012-09-04 19:20 zhongya 阅读(186) 评论(0) 推荐(0)
摘要:View Code 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 5 public class Hdu1715{ 6 public static void main(String args[]){ 7 String s1; 8 BigDecimal a,b; 9 Scanner cin = new Scanner(System.in);10 11 while(cin.hasNext()){12 13 a = cin.nextBigDecim... 阅读全文
posted @ 2012-09-04 19:19 zhongya 阅读(174) 评论(0) 推荐(0)
摘要:比赛时这道题没做出来,后来在网上搜了一种简单的方法,把0,1,2,。。。。20,30,。。90存到一个数组里,n1,n2,n3代表每三位的数,刚开始自动匹配,n3开始计算,遇到million,thousand,hundred,再乘以10^n最后把n1,n2,n3加在一起就是所求结果。View Code 1 #include<stdlib.h> 2 #include<stdio.h> 3 #include<string.h> 4 5 char str[28][15]={"zero", "one", "two&q 阅读全文
posted @ 2012-08-17 08:17 zhongya 阅读(160) 评论(0) 推荐(0)
摘要:View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 char s1[1001],s2[1001]; 6 int cmp (const void *a,const void *b) 7 { 8 if( *(char*)a < *(char *)b ) 9 return 1;10 return -1;11 }12 13 int main()14 {15 int i,j,k,len;16 17 while(scanf("%s",s1)... 阅读全文
posted @ 2012-08-01 23:16 zhongya 阅读(149) 评论(0) 推荐(0)
摘要:一开始拿到这道题时,有点纠结排序后的字符串不知道怎么转回来,最后经别人提醒我把字符和数绑定成一个数组就可以了View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 6 int i; 7 typedef struct 8 { 9 char s[10];10 int n;11 }numble;12 numble num[51];13 14 char word[51][10], sort[51];15 void revers 阅读全文
posted @ 2012-05-24 15:32 zhongya 阅读(132) 评论(0) 推荐(0)
摘要:View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 #include<map> 6 7 using namespace std; 8 9 map<string,string>entry;10 map<string,string>::iterator location,pos;11 int main()12 {13 14 char line[30];15 char english[1 阅读全文
posted @ 2012-04-26 15:23 zhongya 阅读(207) 评论(0) 推荐(0)
摘要:View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define N 1000001 5 6 char s[N]; 7 int main() 8 { 9 int i, j, len,ok;10 11 while(scanf("%s",s)!=EOF && strcmp(s,"."))12 {13 len = strlen(s);14 for(i=1; i<=len; i++)15 {16 ... 阅读全文
posted @ 2012-04-25 08:33 zhongya 阅读(249) 评论(0) 推荐(1)