09 2013 档案
大数相乘
摘要:比赛中经常会遇到大数问题,自己写了一个大数相乘的模板,可能会有Bug,先凑合看吧;#include#includeconst int M = 100;void GetDigit(char s[],int a[]){ int i; memset(a,0,sizeof(int)*M); int len = strlen(s); for(i = 0; i = 0; i--) printf("%d",c[i]); printf("\n"); } return 0;} 阅读全文
posted @ 2013-09-29 18:50 straw_berry 阅读(194) 评论(0) 推荐(0)
Cut the Cake(大数相乘)
摘要:MMM got a big big big cake, and invited all her M friends to eat the cake together. Surprisingly one of her friends HZ took some (N) strawberries which MMM likes very much to decorate the cake (of course they also eat strawberries, not just for decoration). HZ is in charge of the decoration, and he 阅读全文
posted @ 2013-09-28 20:50 straw_berry 阅读(349) 评论(0) 推荐(0)
find the most comfortable road
摘要:XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提速/降速,痛苦呀 ),但XX星人对时间却没那么多要求。要你找出一条城市间的最舒适的路径。(SARS是双向的)。Input输入包括多个测试实例,每个实例包括:第一行有2个正整数n (1 2 #include 3 #include 4 using 阅读全文
posted @ 2013-09-28 10:47 straw_berry 阅读(205) 评论(0) 推荐(0)
Paths on a Grid
摘要:http://poj.org/problem?id=1942题意:一个n*m的格子,从左下角走到右上角有多少种走法,规定只能向上或向右走;思路:解法挺水的,高中学组合数的时候老师给讲过;求C[m+n][n]就可以; 但是这里n,m是32位以内的数,要用double,输出的时候只输出整数部分; 1 #include 2 #include 3 using namespace std; 4 5 double n,m,ans; 6 int main() 7 { 8 cout>n>>m)10 {11 if(n == 0 && m == 0)12 ... 阅读全文
posted @ 2013-09-28 09:47 straw_berry 阅读(175) 评论(0) 推荐(0)
HDOJ迷宫城堡(判断强连通 tarjan算法)
摘要:Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5400Accepted Submission(s): 2411Problem Description为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N 2 #include 3 #include 4 #include 5 using namespace std; 6 7 vectoredge[10010];//用邻接表存图; 8 int n,m; 9 int dfn[100. 阅读全文
posted @ 2013-09-20 20:58 straw_berry 阅读(448) 评论(0) 推荐(0)
Entropy (huffman) 优先队列)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1053Huffman问题利用STL中的priority_queue解决; 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 struct cmp10 {11 bool operator()(const int a, const int b)12 {13 return a > b;14 }15 };16 int solve(string... 阅读全文
posted @ 2013-09-20 18:43 straw_berry 阅读(268) 评论(0) 推荐(0)
Number Sequence
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:31455Accepted:8924DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive integer numbers ranging fr 阅读全文
posted @ 2013-09-19 00:49 straw_berry 阅读(220) 评论(0) 推荐(0)
Code (组合数)
摘要:Time Limit:1000MSMemory Limit:30000KTotal Submissions:7184Accepted:3353DescriptionTransmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a character sequence. It 阅读全文
posted @ 2013-09-17 20:42 straw_berry 阅读(268) 评论(0) 推荐(0)
Round Numbers (排列组合)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:7558Accepted:2596DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) in order to ma 阅读全文
posted @ 2013-09-13 20:03 straw_berry 阅读(301) 评论(0) 推荐(0)
Naive and Silly Muggles (计算几何)
摘要:Naive and Silly MugglesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 137Accepted Submission(s): 94Problem DescriptionThree wizards are doing a experiment. To avoid from bothering, a special magic is set around them. The magic forms a circle, whic 阅读全文
posted @ 2013-09-11 22:23 straw_berry 阅读(328) 评论(0) 推荐(0)
SDUT 最短路径(二维SPFA)
摘要:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2622 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const long long INF = 1LL map[110];12 int inque[110];13 long long dis[110][12];14 int s,t,x,n,m;15 16 void spfa()17 {18 queueque;19 for(int i = 0; ... 阅读全文
posted @ 2013-09-09 23:00 straw_berry 阅读(250) 评论(0) 推荐(0)
Pearls DP
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:6647Accepted:3241DescriptionIn Pearlania everybody is fond of pearls. One company, called The Royal Pearl, produces a lot of jewelry with pearls in it. The Royal Pearl has its name because it delivers to the royal family of Pearlania. But it also 阅读全文
posted @ 2013-09-06 21:09 straw_berry 阅读(252) 评论(0) 推荐(0)
The Cow Lexicon(dp)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:7290Accepted:3409DescriptionFew know that the cows have their own dictionary withW(1 ≤W≤ 600) words, each containing no more 25 of the characters 'a'..'z'. Their cowmunication system, based on mooing, is not very accurate; sometim 阅读全文
posted @ 2013-09-03 21:19 straw_berry 阅读(276) 评论(0) 推荐(0)