当前位置: 首页 > news >正文

重庆 建站 价格惠州建站平台

重庆 建站 价格,惠州建站平台,免备案网站怎么收录,电商网站建设费用价格K K Co-prime Permutation 题意#xff1a;给定n和k#xff0c;让你构造n的排列#xff0c;满足gcd(pi, i)1的个数为k。 思路#xff1a;因为x和x-1互质#xff0c;1和任何数互质#xff0c;任何数和它本身不互质 当k为奇数时#xff0c;p11#xff0c;后面k-1个数…K K Co-prime Permutation 题意给定n和k让你构造n的排列满足gcd(pi, i)1的个数为k。 思路因为x和x-1互质1和任何数互质任何数和它本身不互质 当k为奇数时p11后面k-1个数两两互换 当k为偶数时后面k个数两两互换 #include bits/stdc.h #define ios ios::sync_with_stdio(0),cin.tie(0) #define PII pairint,int typedef long long ll; const int N1e610; const int inf0x3f3f3f3f;using namespace std; int n,k; int a[N]; void solve() {cinnk;if(k0){cout-1\n;return ;}int cnt0;for(int i1;in;i) a[i]i;if(k1){cnt1;for(int i2;incntk;i){if(cnt1) a[i]i1;else a[i]i-1;cnt;}}else{for(int i1;incntk;i){if(cnt%20) a[i]i1;else a[i]i-1;cnt;}}for(int i1;in;i)couta[i] \n[in]; } signed main() {//freopen(input.txt,r,stdin);//freopen(output.txt,w,stdout);ios;int _t1; // cin_t;while(_t--) solve();system(pause);return 0; } L Lets Play Curling 题意给定n块红色石头m块蓝色石头的位置。记红色石头的位置为a[i]蓝色石头的位置为b[i]。当红色石头到目标位置c的距离比蓝色所有石头到目标位置的距离都要小时计一分找到一个c点可以让红队尽可能多赢输出红队尽可能多赢的次数。 思路在两块蓝色石头之间一定存在一个位置满足条件得分为两个蓝色石头之间红色石头的个数。 即求两个蓝色石头之间最多有几个红色石头。 排序后枚举蓝色石头的位置p二分红色石头找到上下界。 #include bits/stdc.h #define ios ios::sync_with_stdio(0),cin.tie(0) #define PII pairint,int typedef long long ll; const int N1e610; const int inf0x3f3f3f3f;using namespace std; int n,m; void solve() {cinnm;vectorinta,b;for(int i1;in;i){int x;cinx;a.push_back(x);}for(int i1;im;i){int x;cinx;b.push_back(x);}b.push_back(0);b.push_back(1e910);sort(a.begin(),a.end());sort(b.begin(),b.end());int ans0;for(int i0;im;i){int lupper_bound(a.begin(),a.end(),b[i])-a.begin();int rlower_bound(a.begin(),a.end(),b[i1])-a.begin();ansmax(ans,r-l);}if(ans0) coutImpossible\n;else coutans\n; } signed main() {//freopen(input.txt,r,stdin);//freopen(output.txt,w,stdout);ios;int _t1;cin_t;while(_t--) solve();system(pause);return 0; } E Evil Coordinate 题意初始位置为(0, 0)给定陷阱位置(x, y)和操作字符串。让我们重排列操作字符串使得不陷入陷阱。 思路设最终位置为(X, Y)若有解则(X, Y)与(x, y)至少有一维坐标不同我们可以先走不同的那个方向再走相同的那个方向。所以我们可以将相同操作排在一起然后枚举UDLR的全排列就可以。 #include bits/stdc.h #define ios ios::sync_with_stdio(0),cin.tie(0) #define PII pairint,int typedef long long ll; const int N1e610; const int inf0x3f3f3f3f;using namespace std; int x,y; string s; int dir[4][2]{0,1,0,-1,-1,0,1,0}; char op[4]{U,D,L,R}; mapint,intcnt; string ans; bool check(vectorintv) {ans.clear();int X0,Y0;for(int i0;i4;i){for(int j0;jcnt[v[i]];j){ansop[v[i]];Xdir[v[i]][0];Ydir[v[i]][1];if(XxYy) return 0;}}return 1; } void solve() {cinxy;cins;if(x0y0){coutImpossible\n;return ;}cnt.clear();for(int i0;is.length();i)if(s[i]U) cnt[0];else if(s[i]D) cnt[1];else if(s[i]L) cnt[2];else cnt[3];vectorintv{0,1,2,3};bool f0;do{if(check(v)){f1;break;}} while (next_permutation(v.begin(),v.end()));if(!f){coutImpossible\n;return ;}else coutans\n; } signed main() {//freopen(input.txt,r,stdin);//freopen(output.txt,w,stdout);//ios;int _t1;cin_t;while(_t--) solve();system(pause);return 0; } F Fireworks 题意小明做一个烟花花费n的时间点燃所有做好的烟花花费m的时间。每个烟花有的概率是完美的。求最优策略下最小时间花费。 思路假设最优策略是每生产k个再一起点燃那么释放一次成功的概率为1-(1-p)^k  (pp*1e-4). 释放几次后得到完美的期望满足几何分布。 几何分布在n次伯努利试验中 试验k次才得到第一次成功的概率。详细的说是前k-1次皆失败 第k次成功的概率。 期望E(x)1/p;(概率论公式不再赘述) 那么答案为E(x)*(nkm) (nkm) / [1-(1-p)^k] 接下来三分寻找答案的最小值。 #include bits/stdc.h #define ios ios::sync_with_stdio(0),cin.tie(0) #define PII pairint,int typedef long long ll; const int N1e610; const int inf0x3f3f3f3f;using namespace std; double n,m; double p; double qmi(double a,int k) {double ret1;while(k){if(k1) retret*a;k1;aa*a;}return ret; } double get(int k) {double t1.0-qmi(1.0-p,k);if(t0) return (double)0x3f3f3f3f;return (k*n*1.0m)/t; } void solve() {cinnmp;pp*1e-4;double ans(double)0x3f3f3f3f3f3f3f3f;int l1,r1e9;while(rl){int lmidl(r-l)/3,rmidr-(r-l)/3;double f1get(lmid),f2get(rmid);ansmin(ans,min(f1,f2));if(f1f2) rrmid-1;else llmid1;}printf(%.10f\n,ans); } signed main() {//freopen(input.txt,r,stdin);//freopen(output.txt,w,stdout);//ios;int _t1;cin_t;while(_t--) solve();system(pause);return 0; }
http://www.dnsts.com.cn/news/26107.html

相关文章:

  • 做网站的公司名字wordpress下载后放哪
  • 源码分享兰州网站建设优化
  • 连连电商网站开发公司ps网站设计全程绝密
  • 深圳定制网站开发wordpress禁止响应
  • 宜昌平台网站建设东营网红桥
  • 深圳专业商城网站网站的排名优化怎么做
  • 郑州做网站的大公松江新桥网站建设
  • asp.net网站管理工具滕州做网站比较好的网络公司
  • 沈阳网站关键字优化提升学历咨询
  • dede小说网站模板下载网站全屏广告
  • 平昌县住房和城乡建设局网站怎么搜索网站搜索量
  • 手机百度屏蔽我网站关键词公共资源交易中心是干嘛的
  • 信息网站制作产品包装设计与制作
  • 南阳seo网站排名优化手把手教建设网站
  • 创业网站怎么做微信公众网站开发
  • 静安做网站的公司微信小程序如何推广
  • 网站开发需要的知识和技术软件开发工程师做什么
  • 商城网站流量wordpress搬家换域名
  • 那些企业需要做网站织梦网站怎么上传
  • 福建 专业网站建设公司浏览器查看WordPress主题
  • 空间放两个网站建设工程施工合同专属管辖
  • 推广网站的软文wordpress安装时候500错误
  • 网站开发基本工资是多少制作免费网站的平台
  • 网站制作时广州专业网站建设
  • 重庆自适应网站建设个人网站可以做资讯吗?
  • 影视传媒公司网站php源码网页无法访问什么原因
  • 做酒店管理网站的作用嵌入式软件开发专业
  • 一些做设计素材的网站网络工程师报名入口官网
  • wordpress设置新页面跳转广州网站建设优化方案
  • 免费网站开发合同范本徐州seo招聘