上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: 原题链接:http://www.acm.uestc.edu.cn/problem.php?pid=1735考试松松过 1 #include<cstdio> 2 using namespace std; 3 int main() 4 { 5 long long n,product;int ans[20]; 6 while(scanf("%lld",&n)!=EOF) 7 { 8 product=(n+1)*(3*n+2)/2; 9 int i=0;10 while(product)11 {12 ... 阅读全文
posted @ 2013-06-10 16:41 EtheGreat 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1690&cid=215分析:dp[i][j]表示前i座山,最后一座的高度为j时的最小费用;状态转移方程:dp[i][j]=min(dp[i-1][k])-A*k+A*j+(h[i]-j)^2 max(j-K,0)<=k<=j;k>j时方程类似;用单调队列优化DP。最少花费 1 #include<cstdio> 2 #define inf 0xfffffff 3 #define min(a,b) a<b?a:b 4 using namespace std; 5 阅读全文
posted @ 2013-06-06 14:26 EtheGreat 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.hdu.edu.cn/submit.php?pid=1052http://acm.nyist.net/JudgeOnline/problem.php?pid=364分析:当二者最快的马速度相同时,要凭借田忌最慢的马与大王最慢的马的速度关系来确定如何比。Tian Ji -- The Horse Racing 1 #include 2 #include 3 #include 4 using namespace std; 5 int a[1005],b[1005]; 6 int main() 7 { 8 int n,i,j,v,front,rear;long ... 阅读全文
posted @ 2013-06-04 18:11 EtheGreat 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1012分析:dp[v]表示可以使用的钱为v时实际上用的钱。饭卡(card) 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<functional> 5 #include<cstring> 6 using namespace std; 7 int m,n,i,v,price[1001],dp[1001]; 8 int main() 9 {10 whi 阅读全文
posted @ 2013-06-03 01:12 EtheGreat 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1020分析:按升序排序即可。Vote 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<functional> 5 using namespace std; 6 int voter[105]; 7 int main() 8 { 9 int n,ans;10 while(scanf("%d",&n)==1)11 {12 if(n==0) 阅读全文
posted @ 2013-06-02 20:03 EtheGreat 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1043输出前m大的数据 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<functional> 5 using namespace std; 6 int queue[1000005]; 7 int main() 8 { 9 int n,m,k;10 while(scanf("%d%d",&n,&m)!=EOF)11 {12 阅读全文
posted @ 2013-06-02 19:41 EtheGreat 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1047Cake 1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 int main() 5 { 6 long long t,n,m; 7 scanf("%lld",&t); 8 while(t--) 9 {10 scanf("%lld%lld",&n,&m);11 printf("%lld\n",n*m-1);12 } 阅读全文
posted @ 2013-06-02 19:39 EtheGreat 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=106分析:排序加贪心。背包问题 1 #include 2 int main() 3 { 4 int n,s,m,i,j,value,temp;int str[11][2]; 5 scanf("%d",&n); 6 while(n--) 7 { 8 value=0; 9 scanf("%d%d",&s,&m);10 for(i=0;i<s;i++)11 scanf("%d%d",&st... 阅读全文
posted @ 2013-05-31 22:31 EtheGreat 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=44分析:经典DP。子串和 1 #include 2 long long T,num,front,i,n,ans; 3 long long max(long long x,long long y) 4 { 5 if(x>y)return x; 6 return y; 7 } 8 int main() 9 {10 scanf("%lld",&T);11 while(T--)12 {13 scanf("%lld",&n);14 . 阅读全文
posted @ 2013-05-31 22:21 EtheGreat 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=68分析:有向图。三点顺序 1 #include 2 int main() 3 { 4 int x1,y1,x2,y2,x3,y3,p;long s; 5 while(scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3)==6) 6 { 7 if(x1==0&&y1==0&&x2==0&&y2==0&&x3==0& 阅读全文
posted @ 2013-05-31 22:17 EtheGreat 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页