06 2013 档案

摘要:原体连接:http://acm.uestc.edu.cn/problem.php?pid=1237分析:质因子单增;在寻找下一个质因子时,从前一个开始。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int isprime(int s,int n) 7 { 8 int i; 9 for(i=s;i2)31 for(int i=3;;)32 {33 if(n==1)break;34 if(n%i==0)35 ... 阅读全文
posted @ 2013-06-22 19:35 EtheGreat 阅读(207) 评论(0) 推荐(0)
摘要:原题链接:http://www.acm.uestc.edu.cn/problem.php?pid=1005分析:判断有无"no"即可。点球大战(penalty) 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 char str[105]; 6 int isOK(char *str) 7 { 8 int len=strlen(str); 9 if(str[len-8]==' '&&str[ 阅读全文
posted @ 2013-06-11 00:27 EtheGreat 阅读(183) 评论(0) 推荐(0)
摘要:原题链接: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 阅读(148) 评论(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 阅读(156) 评论(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 阅读(159) 评论(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 阅读(178) 评论(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 阅读(119) 评论(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 阅读(160) 评论(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 阅读(117) 评论(0) 推荐(0)