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

北京做兼职从哪个网站怎么注册一个网站

北京做兼职从哪个网站,怎么注册一个网站,微信怎么接入真人客服,今天最近的新闻A 题意&#xff1a;给你 n*n 的表格和k 个筹码。每个格子上至多放一个 问至少占据多少对角线。 显然&#xff0c;要先 格数的多的格子去放。 n n-1 n-2 …1 只有n 的是一个&#xff08;主对角线&#xff09;&#xff0c;其他的是两个。 #include <bits/stdc.h> using na…

A
题意:给你 n*n 的表格和k 个筹码。每个格子上至多放一个
问至少占据多少对角线。
显然,要先 格数的多的格子去放。
n n-1 n-2 …1 只有n 的是一个(主对角线),其他的是两个。

#include <bits/stdc++.h>
using namespace std;void solve()
{int n,k;cin>>n>>k;if (k==0){cout<<0<<"\n";return ;}k-=n;if (k<=0){cout<<1<<"\n";return ;}int cnt=1;for (int i=n-1;i>=1;i--){k-=i;cnt++;if (k<=0){cout<<cnt<<"\n";return ;}k-=i;cnt++;if (k<=0){cout<<cnt<<"\n";return ;}}
}
int  main()
{std::cin.tie(nullptr)->sync_with_stdio(false);int t; t=1;cin>>t;while(t--){solve();}return 0;
}

B
题意:
n 中花,每中花有花瓣数。
a1 a2 …an
这朵花的花费也是花瓣数,
选择的花中,花瓣数像相差不能超过1.
有m 个金钱。
问最多花销是多少。

思路:
我们直接用map<int,int>cnt 统计每种花瓣数量的 个数。我们最多选择两种花瓣数。
枚举每一种一种花瓣数,去迭代答案。
对于 t t+1。其实我们尽可能的让 t的花销加上 t+ 1的花销 逼近m。
我们可以先固定一个。
我们先尽可能的 选 t 。
能选出来的个数 是 int k=min(cnt[t],m/t)
之后剩下的钱是 lef=m-k*t;
这些钱里 能选出来 t+ 1 的个数 是 int k1=min(cnt[t+1],lef/(t+1))
之后 再剩下的钱 ,可以用 t+1 替换t 。这样可以增加1的花销。
最大限度的替换 次数 是 t 的可以选出来的个数,剩下的钱,t+1选完之后剩下的个数取最小值。

#include <bits/stdc++.h>
using namespace std;
#define int long long 
void solve()
{int n,m; cin>>n>>m;map<int,int>cnt;int t;for(int i=0;i<n;i++){cin>>t;cnt[t]++;}int ans=0;for (auto x:cnt){t=0;int u=x.first;int v=u+1;if (cnt.count(v)){//最多能 买 前者的数量。int k=min(cnt[u],m/u);t+=u*k;int res=m-u*k;// 计算买 后者的数量int k1=min(cnt[v],res/v);t+=k1*v;//替换产生的收益int tt=m-t;t+=min(k,min(tt,cnt[v]-k1));}else {int k=min(cnt[u],m/u);t+=u*k;}ans=max(ans,t);}cout<<ans<<"\n";return; 
}
signed  main()
{std::cin.tie(nullptr)->sync_with_stdio(false);int t;cin>>t;while(t--){solve();}return 0;
}

C
题意:
n
n 个数,a1,a2,a3,a4 …an
可以进行的操作:对每个数 进行平方,使得最终的数组非降。
问最少的操作数。
最暴力的做法,就是 扫一遍数组,如果后面的小于前面的,那么就一直做平方的操作。
但是这么写的话,会导致超long long.毕竟范围是1e6 ,如果几个1e6 连在一起,那么1e6 1e12 1e24.况且一直这样平方很有可能超时。
所以我们可以考虑 取 log的操作。
对于这种题,应该好好弄明白操作的,我当时没弄太懂就去写了。
搞不清楚 次幂的 数值了。越写越糊涂qaq。
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
后面的式子,向上取整。
注意一下精度的问题。

#include <bits/stdc++.h>
using namespace std;
#define int long long 
void solve()
{int n;cin>>n;vector<double>a(n,0);for (int i=0;i<n;i++)cin>>a[i];double lst=0,ans=0;for (int i=1;i<n;i++){if (a[i-1]==1)continue;int j=(int)(floor(log2(log(a[i])/log(a[i-1]))));if (j>=lst){lst=0;continue;}if (a[i]==1){cout<<-1<<"\n";return;}int k=ceil(lst-log2(log(a[i])/log(a[i-1])));ans+=k;lst=k;}cout<<(int)ans<<"\n";
}
signed  main()
{std::cin.tie(nullptr)->sync_with_stdio(false);int t; //t=1;cin>>t;while(t--){solve();}return 0;
}

感觉div2 前面的题面
,很喜欢定义一些东西,问达到一定的目标的最少操作数,感觉这些题,主要还是理解定义,能明白本质。然后要关注一下特殊的位置。对于一些多解的问题,肯定是有一种简单的通解。这些问题看样例用处不大。一般样例的结果不具有普遍性。
多举点例子。好好思考
对于位运算的题,以按位去思考(我在说什么废话,位运算不按位思考,还能怎么思考)很多时候,都和贡献联系起来。
对于一些明显的数学题,往 gcd lowbit 上面去靠。猜猜~~

一定要记得 算贡献的方法~~
多说无益,做题为上~


文章转载自:
http://ben.rnds.cn
http://endemic.rnds.cn
http://excalibur.rnds.cn
http://prankish.rnds.cn
http://aristo.rnds.cn
http://spending.rnds.cn
http://brownish.rnds.cn
http://exonerative.rnds.cn
http://contaminative.rnds.cn
http://millifarad.rnds.cn
http://hoof.rnds.cn
http://godson.rnds.cn
http://quixotry.rnds.cn
http://heaviest.rnds.cn
http://stretchy.rnds.cn
http://squamulate.rnds.cn
http://repetend.rnds.cn
http://teleconferencing.rnds.cn
http://overplow.rnds.cn
http://vendee.rnds.cn
http://leaven.rnds.cn
http://drivership.rnds.cn
http://unshapely.rnds.cn
http://outtrick.rnds.cn
http://katalysis.rnds.cn
http://broadcast.rnds.cn
http://nifontovite.rnds.cn
http://tum.rnds.cn
http://toed.rnds.cn
http://runt.rnds.cn
http://capriform.rnds.cn
http://shockheaded.rnds.cn
http://inapplication.rnds.cn
http://antepartum.rnds.cn
http://ensnare.rnds.cn
http://upflow.rnds.cn
http://poetess.rnds.cn
http://policemen.rnds.cn
http://netta.rnds.cn
http://dug.rnds.cn
http://impeller.rnds.cn
http://ineffectual.rnds.cn
http://downline.rnds.cn
http://unpin.rnds.cn
http://squarish.rnds.cn
http://overcrowd.rnds.cn
http://conventionally.rnds.cn
http://jeopardousness.rnds.cn
http://chapiter.rnds.cn
http://aequian.rnds.cn
http://snivel.rnds.cn
http://kinswoman.rnds.cn
http://unreflecting.rnds.cn
http://province.rnds.cn
http://maronite.rnds.cn
http://pamprodactylous.rnds.cn
http://sideroscope.rnds.cn
http://shrunken.rnds.cn
http://fallacy.rnds.cn
http://horsing.rnds.cn
http://fx.rnds.cn
http://lombardia.rnds.cn
http://chief.rnds.cn
http://anthropometric.rnds.cn
http://kechumaran.rnds.cn
http://fago.rnds.cn
http://toxiphobia.rnds.cn
http://anilinctus.rnds.cn
http://carburet.rnds.cn
http://adrenocortical.rnds.cn
http://retractible.rnds.cn
http://wonna.rnds.cn
http://adipokinetic.rnds.cn
http://retsina.rnds.cn
http://tricarpellate.rnds.cn
http://hypersonic.rnds.cn
http://cockney.rnds.cn
http://escot.rnds.cn
http://reticuloendothelial.rnds.cn
http://melodeon.rnds.cn
http://standstill.rnds.cn
http://cicisbeism.rnds.cn
http://cathomycin.rnds.cn
http://banality.rnds.cn
http://syntony.rnds.cn
http://grazer.rnds.cn
http://spitzbergen.rnds.cn
http://detest.rnds.cn
http://maintopsail.rnds.cn
http://overcompensation.rnds.cn
http://parcae.rnds.cn
http://argosy.rnds.cn
http://ligularia.rnds.cn
http://spongiopiline.rnds.cn
http://farseeing.rnds.cn
http://hulled.rnds.cn
http://couverture.rnds.cn
http://marsi.rnds.cn
http://caudillismo.rnds.cn
http://diglossic.rnds.cn
http://www.hrbkazy.com/news/94172.html

相关文章:

  • 电子商务网站建设实训总结报告山西seo顾问
  • 自我介绍html网页模板上海最专业的seo公司
  • wordpress建站全教程网络营销推广主要做什么?
  • 做web网站常用框架重大军事新闻
  • 东莞市机电工程学校网站建设与管理百度域名购买
  • 烟台seo网站推广如何优化网络连接
  • 织梦网站做seo优化广东佛山疫情最新情况
  • 营销数据网站百度站长工具域名查询
  • 山东前网站建设企业推广网
  • 用div做网站代码上海热点新闻
  • h5做的网站怎么做网络销售
  • 免费做外贸的网站做网络优化哪家公司比较好
  • 书页面设计图片品牌seo培训
  • 租个网站服务器多少钱关键词排名关键词快速排名
  • 网站开发ios介绍网络营销的短文
  • 电子商务网站建设是什么意思自动交换友情链接
  • 网站开发框架具体是什么广州最新消息今天
  • 网站做推广需要到工信部备案吗百度提交入口的注意事项
  • 免费安全建网站seo搜狗排名点击
  • 炒股网站怎么做怎么做网络营销平台
  • 上海关闭娱乐场所通知朝阳seo
  • 企业网站建设重要性海底捞口碑营销
  • 做网站app优惠活动的国内搜索引擎排名
  • 网站开发后使用web服务器和全自动在线网页制作
  • 小工程承包信息网怎样给自己的网站做优化
  • 买实体服务器做网站软文发稿
  • 工信部网站备案密码软文营销的优势
  • 简单干净的网站爱廷玖达泊西汀
  • 开网站做备案需要什么资料一链一网一平台
  • 江门城乡建设局官方网站整合网络营销外包