2011年8月1日

HDU 1041 递推 大数

摘要: 递推:0->10 ; 1->01; 00->1010; 10->0110; 01->1001; 11->0101;假设a[i]表示第i 步时候的00的个数,由上面的可以看到,00是由01 得到的,所以只要知道a[i-1]的01的个数就能够知道a[i]的00的个数了,那a[i-1]怎么求呢,同样看推导,01由1和00 得到,而第i步1的个数是2^(i-1),所以a[i]=2^(i-3)+a[i-2];大数的话用java比较方便,用C++效率高点import java.io.*;import java.math.*;import java.util.*;publ 阅读全文

posted @ 2011-08-01 22:32 lonelycatcher 阅读(228) 评论(0) 推荐(0) 编辑

HDU 1040 排序 大水题一道

摘要: /* * Author:lonelycather * problem:hdu 1040 * Type:简单排序 */#include<stdio.h>#include <iostream>#include<algorithm>using namespace std;int cmp(const void* a,const void* b){ return *(int*)a-*(int*)b;}int N;int sequence[1000];int main(){ int T,i; cin>>T; while(T--) { cin>>N 阅读全文

posted @ 2011-08-01 15:39 lonelycatcher 阅读(334) 评论(0) 推荐(0) 编辑

HDU 1039 字符串处理

摘要: 小水题一道,关键是第二个要求中状态的转移 hehhe/** Author:loneylycatcher* problem:hdu 1039* Type:字符串处理*/#include <iostream>#include<string.h>#include<stdio.h>#include<cstdlib>using namespace std;string s;int main(){ setbuf(stdout,NULL); int i; while(cin>>s) { if(s.compare("end")== 阅读全文

posted @ 2011-08-01 14:46 lonelycatcher 阅读(299) 评论(0) 推荐(0) 编辑

HDU 1036 字符串模拟题

摘要: 这道字符串的题目其实并不简单,因为中间有许多的细节需要注意,注意这里的精度设计是四舍五入/* * Author:lonelycatcher * problem:HDU 1036 * Type:字符串处理 */#include <iostream>#include<string>#include<string.h>#include<stdio.h>using namespace std;int N,num;double dis;int main(){ setbuf(stdout,NULL); int i; cin>>N>>d 阅读全文

posted @ 2011-08-01 09:15 lonelycatcher 阅读(415) 评论(1) 推荐(0) 编辑

HDU 1035

摘要: 简单模拟题,主要就是判别x和y 在不同方向下的坐标的变化/** Author:lonelycatcher* Problem:hdu 1035* Type:模拟,水题*/#include<iostream>#include<stdio.h>#include<string.h>using namespace std;struct node{char data;int visited;};node map[10][10];int row,colum,start;int main(){setbuf(stdout,NULL);int i,j,x,y,loop,step 阅读全文

posted @ 2011-08-01 08:18 lonelycatcher 阅读(329) 评论(0) 推荐(0) 编辑

HDU 1034 各种水,各种暴力都能过

摘要: /** Author:lonelycatcher* peoblem:hdu 1034* Type:模拟暴力各种暴力都能过*/#include<string.h>#include<stdio.h>#include<iostream>using namespace std;int OK,N;int candy[100000];int main(){setbuf(stdout,NULL);int i,steps; while(scanf("%d",&N)!=EOF) { steps=0; if(!N)break; for(i=1;i&l 阅读全文

posted @ 2011-08-01 08:16 lonelycatcher 阅读(439) 评论(0) 推荐(0) 编辑

HDU 1033 水题

摘要: 题意还真的不好懂,摸索数据就出来了,注意顺时针和逆时针时候的方向变化/** Author:lonelycatcher* problem:hdu 1033* Type:水题*/#include<string.h>#include<iostream>#include<string>#include<stdio.h>#include<cstdlib>using namespace std;string command;int main(){while(cin>>command){printf("300 420 move 阅读全文

posted @ 2011-08-01 08:15 lonelycatcher 阅读(497) 评论(0) 推荐(0) 编辑

HDU 1032 水题

摘要: /** Author:lonelycatcher* problem:heu 1032* type:纯水题*/#include <iostream>#include<stdio.h>#include<string.h>#include<string.h>using namespace std;int fun(int x){int i=1;while(x!=1){if(x&1){x=3*x+1;}else{x=x>>1;}i++;}return i;}int main(){setbuf(stdout,NULL);int left, 阅读全文

posted @ 2011-08-01 08:14 lonelycatcher 阅读(218) 评论(0) 推荐(0) 编辑

HDU1031 排序题

摘要: /** Author:lonelycatcher* Problem:HDU 1031* Type:排序水题*/#include<iostream>#include<stdio.h>#include<math.h>#include<algorithm>using namespace std;int N,M,K;struct node{double value;int index;};node nodes[1000000];int cmp1(const void* a,const void* b){node c=*(node*)a;node d=*( 阅读全文

posted @ 2011-08-01 08:12 lonelycatcher 阅读(483) 评论(0) 推荐(0) 编辑

导航