周赛题解报告-2013 亚洲南京区域赛
来源:互联网 发布:网络与手机失泄密 编辑:程序博客网 时间:2024/04/20 03:55
全是2013 亚洲南京区域赛的题
感触挺深的。。
补了五道题,之后要是补了会加上来。。。。
A:GPA 水题没什么好说的
B;Poor Warehouse Keeper 贪心
这道题被精度wa了。。。1e-5
要以最短的步数到达给定的x,y
可以看出x的增加次数是固定的
步数要最短,那么我们贪心的原则就是在x越小的情况下使得y的增长到极限
极限是什么呢,就是当前的均值要小于等于(y+1-eps)/x (因为最后的y值可能不为整数,所以+1-eps)
/*ID: meixiny1PROG: testLANG: C++11*/#include <cstdio>#include <cstdlib>#include <iostream>#include <algorithm>#include <cstring>#include <climits>#include <string>#include <vector>#include <cmath>#include <stack>#include <queue>#include <set>#include <map>#include <sstream>#include <cctype>using namespace std;typedef long long ll;typedef pair<int ,int> pii;#define MEM(a,b) memset(a,b,sizeof a)#define CLR(a) memset(a,0,sizeof a);const int inf = 0x3f3f3f3f;const int MOD = 1e9 + 7;#define PI 3.1415926535898//#define LOCALint main(){#ifdef LOCALfreopen("in.txt", "r", stdin);//freopen("out.txt","w",stdout);#endifdouble x,y;ll cnt = 0;while(scanf("%lf%lf",&x,&y)!=EOF){if(y<x){printf("-1\n");continue;}else{double k = 1.0*(y+1-1e-5)/x;double tt = 1.0;cnt = x-1;for(ll i=1;i<=(int)x;i++){double t = i*k;ll u = (ll)(t-tt);tt += u;tt = tt*(1+i)/i;cnt+=u;}}printf("%lld\n",cnt);}return 0;}Campus Design 轮廓线dp
听说是插头dp,但是看了cqd的论文看不懂,感觉这个可以自己yy
这道题的dp的精髓在于由0-n然后对于每次对于每一个m,更新当前小于m的所有情况
然后使用动态数组直到遍历完每一个格子
/*ID: meixiny1PROG: testLANG: C++11*/#include <cstdio>#include <cstdlib>#include <iostream>#include <algorithm>#include <cstring>#include <climits>#include <string>#include <vector>#include <cmath>#include <stack>#include <queue>#include <set>#include <map>#include <sstream>#include <cctype>using namespace std;typedef long long ll;typedef pair<int ,int> pii;#define MEM(a,b) memset(a,b,sizeof a)#define CLR(a) memset(a,0,sizeof a);const int inf = 0x3f3f3f3f;const int MOD = 1e9 + 7;#define PI 3.1415926535898//#define LOCALint dp[2][23][1<<10];char ch[105][15];int mp[105][15];int main(){#ifdef LOCALfreopen("in.txt", "r", stdin);//freopen("out.txt","w",stdout);#endifint n,m,c,d;while(scanf("%d%d%d%d",&n,&m,&c,&d)!=EOF){MEM(dp,0);for(int i=1;i<=n;i++){scanf("%s",ch[i]);}int all = 1<<m;for(int i=1;i<=n;i++)for(int j=0;j<m;j++)mp[i][j] = ch[i][j]-'0';int p = 0;dp[p][0][all-1]=1;for(int i=1;i<=n;i++){for(int j=0;j<m;j++){p^=1;if(!mp[i][j]){for(int t=0;t<=d;t++){for(int k=0;k<all;k++){if(k&(1<<j))dp[p][t][k|(1<<j)]=(dp[p][t][k|(1<<j)]+dp[p^1][t][k])%MOD;}}}else{for(int t=0;t<=d;t++){for(int k=0;k<all;k++){//不放if(k&(1<<j))dp[p][t][k&(all-(1<<j)-1)]=(dp[p][t][k&(all-(1<<j)-1)]+dp[p^1][t][k])%MOD;//放1*1if(k&(1<<j))dp[p][t+1][k|(1<<j)]=(dp[p][t+1][k|(1<<j)]+dp[p^1][t][k])%MOD;//横放if(j && !(k&(1<<(j-1))) && k&(1<<j))dp[p][t][k|(1<<(j-1))|(1<<j)]=(dp[p][t][k|(1<<(j-1))|(1<<j)]+dp[p^1][t][k])%MOD;//竖放if(!(k&(1<<j)))dp[p][t][k|(1<<j)]=(dp[p][t][k|(1<<j)]+dp[p^1][t][k])%MOD;}}}MEM(dp[p^1],0);}}int ans=0;for(int i=c;i<=d;i++){//for(int j=all-1;j<all;j++){ans=(ans+dp[p][i][all-1])%MOD;//}}printf("%d\n",ans);}return 0;}
还有一个题是考读题的,就不贴上来了
0 0
- 周赛题解报告-2013 亚洲南京区域赛
- 2014ACM/ICPC亚洲区域赛现场赛D和K题解题报告
- 南京区域赛总结
- HDU 4771 Stealing Harry Potter's Precious 2013亚洲区域赛杭州赛区 B 题题解
- 南京2013区域赛C题,HDU4804
- 2013 ACM-ICPC 亚洲区域赛 成都现场赛I 解题报告
- 2013ACM/ICPC亚洲区南京站现场赛
- 2013 南京现场赛部分题解
- 2013亚洲区域赛杭州站总结
- 2013 亚洲区域赛成都站
- 2013亚洲区域赛长春站总结
- 2013 亚洲区域赛 长沙站
- 2017青岛赛区亚洲区域赛网络赛 1011题题解
- hdu4771 Stealing Harry Potter's Precious 亚洲区域赛杭州赛区第二题题解
- 2015 亚洲区域赛长春赛区网络赛解题报告(9/13)
- 2016 大学生程序设计竞赛亚洲区域赛青岛赛区(ICPC)解题报告
- 2014ACM/ICPC亚洲区鞍山赛区现场赛题解报告
- 2016ACM/ICPC亚洲区沈阳站现场赛题解报告
- PythonScript_demo--搭建PXE服务器
- Cocoapods系列教程(三)——私有库管理和模块化管理
- mysql
- Zenefits 第一轮编程题
- [leetcode] 253. Meeting Rooms II 解题报告
- 周赛题解报告-2013 亚洲南京区域赛
- 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) D635 - Factory Repairs 线段树
- transformation action
- hive 结构
- 学习Javascript闭包(Closure)讲的很深入透彻
- DE 27 Sketching Solutions of 2x2 Homogeneous Linear System with Constant Coefficients
- DE28 Matrix Methods for Inhomogeneous Systems
- [leetcode] 49. Group Anagrams 解题报告
- Hive QL