2012年8月18日

hdu1274 展开字符串

摘要: 1 #include<stdio.h> 2 #include<ctype.h> 3 #include<string.h> 4 char s[260]; 5 int dfs(int ith) 6 { 7 int k,e; 8 char c; 9 for(c=s[ith++];ith<strlen(s)&&c!=')';c=s[ith++])//递归结束的条件是字符串结束或遇到右括号 10 {11 for(k=0;isdigit(c);c=s[ith++])12 k=k*10+c-'0';13 if(!k) 阅读全文

posted @ 2012-08-18 10:40 小花熊 阅读(546) 评论(0) 推荐(0) 编辑

hdu递推公式水题

摘要: hdu2013蟠桃记 1 #include<stdio.h> 2 int main() 3 { 4 long long day,x,ans[31]; 5 for(int i=1;i<31;++i){ 6 x=1; 7 day=i; 8 while(--day) 9 x=(x+1)<<1;10 ans[i]=x;11 }12 while(~scanf("%I64d",&day))13 printf("%I64d\n",ans[day]);14 retu... 阅读全文

posted @ 2012-08-18 10:12 小花熊 阅读(220) 评论(0) 推荐(0) 编辑

导航