上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 182 下一页
摘要: 栈模拟View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <stack>using namespace std;#define maxn 1005int n;int f[maxn];void input(){ for (int i = 1; i < n; i++) scanf("%d", &f[i]);}bool ok(){ stack<int> stk; in 阅读全文
posted @ 2013-01-18 11:11 undefined2024 阅读(441) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 55int n;int f[maxn];int main(){ //freopen("t.txt", "r", stdin); int t = 0; while (scanf("%d", &n), n) { for (int i = 0; i &l 阅读全文
posted @ 2013-01-18 10:52 undefined2024 阅读(279) 评论(0) 推荐(0)
摘要: 递推View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 15#define maxk 1005#define maxd 35#define inf 0x3f3f3f3fint n, m;int f[maxn][maxk];int flight_num[maxn][maxn];int flight[maxn][maxn][maxd];void input(){ for (i 阅读全文
posted @ 2013-01-18 10:35 undefined2024 阅读(152) 评论(0) 推荐(0)
摘要: 排序View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define maxn 1005#define maxl 55struct Word{ char name[maxl];}word[maxn];int word_num, int_num;bool is_word[maxn];int number[maxn];void uni_case(c 阅读全文
posted @ 2013-01-16 21:11 undefined2024 阅读(181) 评论(0) 推荐(0)
摘要: 题意:一叠卡片,用一种摆法,要求每张卡片短边与桌檐平行,并让他们超出桌檐尽量多,问能超出桌檐多少。分析:对于n张卡片的最佳摆法,我们只需要在n-1张卡片的摆法下面加一张边缘与桌檐重合的卡片,并将所有卡片一起向桌檐外移动。对于一种最佳摆法,其中心一定在桌檐上,所以一定符合杠杆原理,支点是桌檐。那么对于n张卡片的情况,我们假设第n张向外移动了x,那么前n-1张的重心就在桌檐外x,因为他们的重心在n-1张卡片时原本在桌檐上。第n张卡片的重心在桌檐内0.5-x处,那么我们可以列出杠杆平衡方程:(0.5-x)*1=x*(n-1)解得:x=1/(2n)。那么我们所要的答案也就是1/2+1/(2× 阅读全文
posted @ 2013-01-16 09:34 undefined2024 阅读(492) 评论(0) 推荐(0)
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 182 下一页