上一页 1 ··· 73 74 75 76 77 78 79 80 81 ··· 139 下一页
摘要: 嵌套玩具, 要求外层玩具的尺寸比内层玩具尺寸的和要大. 每一个玩具由一个负数与相应的正数表示, 在这两数之间的部分即为此玩具内部的玩具. 要求判断一串输出的数字是否能组成一个合法的玩具. 一个合法的玩具: 1. 数字代表了 toy 的尺寸大小. 2. 外层的 size 必须 > 内层 size 的和, 不能是 >=. 3. 每次必须是负正对一起出现. 思路: 用一个... 阅读全文
posted @ 2014-03-21 13:27 katago 阅读(319) 评论(0) 推荐(0)
摘要: // UVa673 Parentheses Balance // 题意:输入一个包含()和[]的括号序列,判断是否合法。 // 具体递归定义如下:1.空串合法;2.如果A和B都合法,则AB合法;3.如果A合法则(A)和[A]都合法。 // 算法:用一个栈。注意输入可能有空串 #include#include#include#include#include#includ... 阅读全文
posted @ 2014-03-20 14:52 katago 阅读(787) 评论(0) 推荐(0)
摘要: //这个算法用到了“相对位置”的思想,并且就本题而言还有一个很重要的结论就是,假设 //移动了k个元素,那么这k个元素一定是最后结果的那个序列的前k个元素,而且易知, //越先移动的元素一定会越被压在移动的元素的底部 首先找到需要移动的字符串,方法如下:以初始序列为准,设初始序列下标为i, 目的序列下标为j, 从n-1开始,如果两下标对应的字符串相等,下标同时减一,否则仅初始序列下标... 阅读全文
posted @ 2014-03-20 10:24 katago 阅读(257) 评论(0) 推荐(0)
摘要: 题意:给出n条线段,以米的单位给出,小数点后两位(精确到厘米),要你对这些线段裁剪,裁剪出m条等长的线段,并且让这些线段尽可能长另外线段的长度不能小于1厘米,如果筹不够m条,输出0.00 #include#include#include#include#includeusing namespace std;const int maxn=10010;double num[maxn];doub... 阅读全文
posted @ 2014-03-18 15:46 katago 阅读(257) 评论(0) 推荐(0)
摘要: fengyun@fengyun-server:~/learn/acm/poj$ cat 1979.cpp #include #include #include #include #include #include//istringstream #include #include using namespace std; char map... 阅读全文
posted @ 2013-11-11 11:34 katago 阅读(469) 评论(0) 推荐(0)
摘要: 学到两个: //ignore \n cin.ignore(); //ignore a line cin.ignore(1024, '\n'); #include#include#include#include#include#include//uva 10033 Problem G: Interpreter#define ONLINE_JUDGEusing namespac... 阅读全文
posted @ 2013-10-30 15:18 katago 阅读(583) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include #include using namespace std; int m; int n; //bmp[y][x] char bmp[251][251]; void swap_if_bigger(int& x, int& y) ... 阅读全文
posted @ 2013-10-30 11:19 katago 阅读(490) 评论(0) 推荐(0)
摘要: #include #include #include #include using namespace std;string numbers[5][10]={ " - ", " ", " - ", " - ", " ", " - ", " - ", " - ", " - ", ... 阅读全文
posted @ 2013-10-30 11:17 katago 阅读(492) 评论(0) 推荐(0)
摘要: #include #include #include #include #include using namespace std; /* * A solution for "The Trip" problem. * UVa ID: 10137 */ #include int main (int argc, const char... 阅读全文
posted @ 2013-10-23 14:15 katago 阅读(674) 评论(0) 推荐(0)
摘要: #include#include#include#include#include#includeusing namespace std;int n, m;char x[101][101];void calc(){ for(int i=0;i=0 && a=0 && b0) printf("\n"); count++; printf("F... 阅读全文
posted @ 2013-10-23 14:13 katago 阅读(688) 评论(0) 推荐(0)
上一页 1 ··· 73 74 75 76 77 78 79 80 81 ··· 139 下一页