上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 57 下一页
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1361题目意思: 根据输入的P-sequence , 输出对应的W-sequence. P-sequence: 表示每个右括号前有多少个左括号; W-sequence: 表示每个右括号要经过多少个左括号... 阅读全文
posted @ 2014-04-17 15:26 windysai 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 用STL 中的 Map 写的 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using n... 阅读全文
posted @ 2014-04-15 20:28 windysai 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1047题目意思:就是求大整数加法。有多个案例,每个案例之间要输出一个空格。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 10000 + 10; 8 char t[maxn]; 9 int s[maxn], ans[maxn];10 11 int main()12 {13 int l1, l2, n, i, j, l, len, num;14 s... 阅读全文
posted @ 2014-04-03 22:06 windysai 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Integer in C++Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)SubmitStatistic Next ProblemProblem Description KIDx: I like Java much more than C++, because I can use BigInteger in Java. :)However, KIDx has to use C++ language to do a project...Li... 阅读全文
posted @ 2014-03-30 11:47 windysai 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=342题目意思:判断一行字符串为以下四种的哪一种:A regular palindrome,A mirrored string,A mirrored palindrome 和is not a palindrome。A regular palindrome 就是我们见得最多的普通回文字符串,正读和反读是一样的;A mirrored string 就是根据以下的一套规则,将每个 阅读全文
posted @ 2014-03-29 19:19 windysai 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3617题目意思:给出一条长度为n的字符串S,目标是要构造一条字典序尽量小,长度为n的字符串T。构造的规则是,如果S的头部的字母 S的尾部的字母,那么将S的尾部的字母加入到T中,删除S的尾部的字母。 这个题目的关键是如何处理 S 的头部的字母(假设用 i 指示) = S的尾部的字母(j) 这种情况。此时需要比较 i+1 和 j-1 的位置的字母,如果相同,继续比较下去。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn =... 阅读全文
posted @ 2014-03-24 21:00 windysai 阅读(595) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/405/D题目意思:从 1 ~ 1000000 中选择 n 个数:x1,x2,...,xn,对 x1-1,x2-1,...xn-1 求和得s1。然后在1 ~ 1000000 中除已经选择过的n个数中选择一些数,假设为y1, y2,...ym,设s = 1000000,对s-y1,s-y2,...,s-ym求和,如果这个和与s1相等,则输出y1,y2,...,ym 可以这样想,由于集合X中:x1,x2,...,xn 是各不相同的,那么在S - X,设为Y(假定S是全集:1,2,...,n)对每个数xi(. 阅读全文
posted @ 2014-03-23 16:43 windysai 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/400/C题目意思:给出一个n行m列的矩阵,问经过 x 次clockwise,y 次 horizontal rotate 和z次counterclockwise 之后,原来在n行m列的矩阵的坐标去到哪个位置。 题目意思很容易看懂。易知,对于clockwise,counterclockwise的次数,mod 4 == 0 相当于没有改变!而对于 horizontal rotate,mod 2 == 0 也是没有改变的! 假设问的坐标是(i, j),那么经过一次clockwise的转变,坐标变为(j, n. 阅读全文
posted @ 2014-03-22 21:56 windysai 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/404/B题目意思:Valera 参加马拉松,马拉松的跑道是一个边长为a的正方形,要求Valera从起点(0,0)出发,每经过距离d就给他一杯drink。求出n个位置,即Valera每经过d距离的position。 一开始我是直接模拟的,每次算出一个position就记录离该边最末还剩多少距离,假设为k,然后更新初始已有的距离k,又开始加a的距离直到到达下一个点...代码复杂之余,还超时了。 比较好的作法是:既然要求position,那么这个position一定是经过 i*d(i = 1 ~ n) 的距 阅读全文
posted @ 2014-03-22 11:33 windysai 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 题目描述: Word CountingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 128000/64000 KB (Java/Others)SubmitStatistic Next ProblemProblem DescriptionEach year on May the graduate students are busy writing thesis, and the graduation thesis needs thousands of words. It's not a simple ... 阅读全文
posted @ 2014-03-19 15:13 windysai 阅读(302) 评论(0) 推荐(0) 编辑
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 57 下一页