摘要: //题目链接: //http://poj.org/problem?id=2676 //http://www.lightoj.com/volume_showproblem.php?problem=1397 1 #include 2 #include 3 #include 4 #i... 阅读全文
posted @ 2013-07-15 16:05 YaLing 阅读(262) 评论(0) 推荐(0)
摘要: 题目链接: http://acm.nyist.net/JudgeOnline/problem.php?pid=117 1 #include 2 #include 3 using namespace std; 4 5 int a[1000001], b[1000001]; 6 long lo... 阅读全文
posted @ 2013-07-09 20:24 YaLing 阅读(203) 评论(0) 推荐(0)
摘要: 题目链接: http://acm.nyist.net/JudgeOnline/problem.php?pid=119 1 #include 2 #include 3 #include 4 using namespace std; 5 #define maxn 100001 6 7 int ... 阅读全文
posted @ 2013-07-09 17:44 YaLing 阅读(377) 评论(0) 推荐(0)
摘要: 幂时间限制:3000 ms | 内存限制:65535 KB难度:4描述在学习循环的时候,我们都练习过利用循环计算a的k次方。现在给定整数k和一个整数m,请你求出对应的整数a,使得a的k次方是不超过m并且最接近m的数值。 输入一个整数T表示测试组数。 对于每组测试数据: 给定两个整数k和m 数据范围:... 阅读全文
posted @ 2013-05-16 19:43 YaLing 阅读(267) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 using namespace std; 4 #define N 1000000010 5 int sum,n,p[50001][21],len[50001],L[21],R[21]; 6 7 void merger(int a[],int b... 阅读全文
posted @ 2013-05-07 19:22 YaLing 阅读(189) 评论(0) 推荐(0)
摘要: #include #include #includeusing namespace std;int main(){ int n,a[2001],b[2001],i,j,ii,jj,asn; bool visit[2001]; while(cin>>n) { me... 阅读全文
posted @ 2013-05-02 17:37 YaLing 阅读(192) 评论(0) 推荐(0)
摘要: 悲剧了好几次,应该先判断栈是否为空,才能取栈顶元素,应该记住啊! 1 #include <iostream> 2 #include <stack> 3 #include<string> 4 #include<cstdlib> 5 #include<cstdio> 6 #include<algorithm> 7 using namespace std; 8 stack<double> num; 9 stack<char> sc; 10 double exp(double n1, double n2, 阅读全文
posted @ 2013-05-02 13:43 YaLing 阅读(227) 评论(0) 推荐(0)
摘要: 状态转移方程:d[i, j]=max(d[i, j-1],d[i+2^(j-1), j-1])#include #include#includeusing namespace std;#define M 100001#define max(a,b) a > b ? a : b#define min(... 阅读全文
posted @ 2013-05-02 10:53 YaLing 阅读(139) 评论(0) 推荐(0)
摘要: //01背包优化:#include #include#includeusing namespace std;struct per{ int money,exp;}p[1001];int dp[1000001];int main(){ int N,T,M,i,j,sum; scanf... 阅读全文
posted @ 2013-05-01 00:34 YaLing 阅读(122) 评论(0) 推荐(0)
摘要: #include#include#includeusing namespace std;int mat[101][101], temp[101], m, r,c;void f(int *a){ int i,sum = 0; for(i = 0; i 0) sum... 阅读全文
posted @ 2013-04-28 20:36 YaLing 阅读(135) 评论(0) 推荐(0)