滑雪Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 58507Accepted: 21298DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9一个人可以从某个点滑向... Read More
posted @ 2012-07-13 16:11 godjob Views(346) Comments(0) Diggs(0) Edit
就是翻转饼干的题目,代码写得不是很好,算了#include <iostream>#include <string>#include <algorithm>#include <sstream>#include <vector>//#include <iterator>//#include "boost/foreach.hpp"using namespace std;int main(){ //循环处理输入的每组字符串。每次循环一轮要输出最后的0和换行 for (string strLine; getlin Read More
posted @ 2012-07-07 23:34 godjob Views(147) Comments(0) Diggs(0) Edit
//做这种题我知道了,以后数字能定多大就定多大,最后就long long int,前面都是把数字定义为int,老是WA#include <iostream>#include <string>#include <sstream>#include <algorithm>using namespace std;int main(){ string str1,str2,str3; while(cin>>str1>>str2>>str3) { unsigned long int p = 0; unsigned long Read More
posted @ 2012-06-30 22:46 godjob Views(226) Comments(0) Diggs(0) Edit
没做,没感觉,做这类题提不起劲#include <stdio.h> #include <string.h> long long p[10001]; char num[10001]; int main() { long long i,j,k,len,n,mod; char lat[3]; while(scanf("%s%s%lld",num,lat,&n)!=EOF) { memset (p,0,sizeof(p)); len = strlen(num); for(i = 0;i <= len-1;i ++) ... Read More
posted @ 2012-06-28 22:53 godjob Views(174) Comments(0) Diggs(0) Edit
这题没做,直接在网上看了别人的代码,对数字的一些问题不是很了解学习一下istringstream的用法:#include <iostream>#include <string>#include <sstream>//使用istringstream()需要调入的头文件using namespace std;string getMaxStr(){ int n=0x7fffffff; string s=""; while(n!=0) { s=(char)(n%10+'0')+s; n=n/10; } return s;}bool Read More
posted @ 2012-06-27 23:14 godjob Views(198) Comments(0) Diggs(0) Edit
#include <iostream>#include <algorithm>#include <cstring>using namespace std;int mutil(char * x, char * y , char * z){ char * px = x; char * py = y; int carry =0 , temp; if(strcmp(x,"0") == 0 || strcmp(y,"0") == 0) { z[0] = 0; return 1; } int i,j; for(i = 0 ; *( Read More
posted @ 2012-06-27 21:53 godjob Views(131) Comments(0) Diggs(0) Edit
水题,就是把非常大的数组进行相加#include <iostream>#include <algorithm>#include <cstring>using namespace std;char table_atoi[128];//下标字母 对应 数字int main(){ int i =0; char c = '0'; for( ; i < 10 ; ++i ,++c) { table_atoi[c] = i; } char buff[100]; char result[100] = {0}; char carry = 0; int Read More
posted @ 2012-06-25 22:51 godjob Views(191) Comments(0) Diggs(0) Edit
该题有ANSI C写了一遍,通过使用二叉树的思想可以很好的解决这个问题,该题是用UVa系统测评的,发现如果用标准的C写代码的话,语法要求真的很严格,提交了几次都是语法错误,单行注释都报错,最要紧的是连内建的bool类型都没有,所以我用int型代替,下面是AC的代码#include <stdio.h>#define Nil -1char left[50], right[50], tree_index[50];char code[40];int top = 0;int tree_root = -1;char* out_buff_is = "Set %d is immediat Read More
posted @ 2012-06-25 17:20 godjob Views(222) Comments(0) Diggs(0) Edit
Text-processing tools like awk and sed allow you to automatically perform a sequence of editing operations based on a script. For this problem we consider the specific case in which we want to perform a series of string replacements, within a single line of text, based on a fixed set of rules. Each Read More
posted @ 2012-06-24 23:17 godjob Views(198) Comments(0) Diggs(0) Edit
Immediate DecodabilityAn encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all codes are in binary, that no two codes within a set of codes are the same, that each code has at l. Read More
posted @ 2012-06-24 20:54 godjob Views(297) Comments(0) Diggs(0) Edit