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

做外贸是什么网站广州竞价托管代运营

做外贸是什么网站,广州竞价托管代运营,网站建设用什么程序,微信公众号微官网怎么做文章目录 1 十二生肖基本思路: 2 欢迎参加福建省大学生程序设计竞赛基本思路:代码: 3 匹配二元组的数量基本思路:代码: 4 元素交换基本思路:代码: 5 下棋的贝贝基本思路:代码: 6 方程…

文章目录

  • 1 十二生肖
    • 基本思路:
  • 2 欢迎参加福建省大学生程序设计竞赛
    • 基本思路:
    • 代码:
  • 3 匹配二元组的数量
    • 基本思路:
    • 代码:
  • 4 元素交换
    • 基本思路:
    • 代码:
  • 5 下棋的贝贝
    • 基本思路:
    • 代码:
  • 6 方程
    • 思路:
    • 代码:


1 十二生肖

基本思路:

  • 签到题! 龙 -> 5

2 欢迎参加福建省大学生程序设计竞赛

基本思路:

  • 一道排序的题,先按题数排序,题树相等时,按罚时排序

代码:

#include<bits/stdc++.h>
using namespace std;#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long 
const int N = 1e6+10, INF=1e18+10;
struct Node{int x,y;
};
vector<Node> a;
bool cmp(Node xx,Node yy){if(xx.x!=yy.x)return xx.x>yy.x;return xx.y<yy.y;
}void solve(){int n; cin>>n;for(int i=1;i<=n;i++){int x,y; cin>>x>>y;a.push_back({x,y});}sort(a.begin(),a.end(),cmp);int num=0,prex=-1,prey=-1;for(auto i:a){//计算不相同的次数if(i.x==prex&&i.y==prey) continue;num++;prex=i.x; prey=i.y;}cout<<num;
} signed main(){IOS;int T=1;
//	cin>>T;while(T--){solve();}return 0;
}

3 匹配二元组的数量

基本思路:

  • 一对二元组(i,j)下标需要满足两个条件,一个是i<j,另一个是ai/j==aj/i. 对于第二个条件,我们不妨变一下形,得到aii == ajj.
  • 每个数的值都乘以它的下标(下标从1开始),问题就变成了找到有多少个数相等,从这些数中任意选出两个组成一个匹配二元组,这不就是组合数吗,答案加上每个数个数的C(n,2),可以用哈希统计每个数有多少个!

代码:

#include<bits/stdc++.h>
using namespace std;#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long 
const int N = 1e6+10, INF=1e18+10;
unordered_map<int,int> mp;
int n,ans;void solve(){cin>>n;vector<int> a(n+1);for(int i=1;i<=n;i++)cin>>a[i],mp[i*a[i]]++;for(auto i:mp)ans+=i.se*(i.se-1)/2;cout<<ans;} signed main(){IOS;int T=1;
//	cin>>T;while(T--){solve();}return 0;
}

4 元素交换

基本思路:

  • 2*N的二进制数组,其中0、1的个数各占一半,要求交换任意两个元素,使得最后的数组不存在连续的0或1
  • 我们可以发现最后数组只可能有两种状态:
  • 一个状态是010101…01
  • 另一个状态是101010…10
  • 我们只需统计当前数组与目标数组(目标数组为以上两种状态中的一种)有多少个不同的元素,假设有x个不同的元素,那么x/2即为操作次数,为什么呢?因为每交换一次,就有两个元素回到正确的位置。
  • 最后我们只需取两种情况中的最小值,即为最小操作次数!

代码:

#include<bits/stdc++.h>
using namespace std;#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long 
const int N = 1e6+10, INF=1e18+10;
unordered_map<int,int> mp;
int ans=0;void solve(){int n;cin>>n;vector<int> a(2*n+1),b(2*n+1),c(2*n+1);for(int i=1;i<=2*n;i++){b[i]=0,c[i]=0;}for(int i=1;i<=2*n;i++)cin>>a[i];for(int i=1;i<=2*n;i++)//构造两个目标数组,其实也可以不用实现,判断奇偶即可if(i&1) b[i]=1;else c[i]=1;
//	for(int i=1;i<=2*n;i++) cout<<b[i]<<' ';cout<<endl;
//	for(int i=1;i<=2*n;i++) cout<<c[i]<<' ';cout<<endl;int ans=INF,n1=0,n2=0;for(int i=1;i<=2*n;i++){if(a[i]!=b[i]) n1++;if(a[i]!=c[i]) n2++;}cout<<min(n1/2,n2/2);
} signed main(){IOS;int T=1;
//	cin>>T;while(T--){solve();}return 0;
}

5 下棋的贝贝

基本思路:

  • 首先我们需要理解题意,两个点坐标的曼哈顿距离等于1,这两点就是邻居!求出所有棋子邻居数量总和的最大值是多少?
  • 画图的可能会更直观些在这里插入图片描述
  • 有图可以发现,我们更倾向于构造正方形,这样能才能保证邻居数量总和最大
  • 每个棋子的最多的邻居是4个,即上下左右都是邻居。还可以发现处于边界位置的方块可能有一个邻居,两个邻居或者三个邻居。
  • 我们不妨假设每个棋子都有4个邻居,那么所有棋子邻居数量总和就为4n,然后在减去每个棋子多出来的邻居,由图不难发现,只有处于边界的棋子的邻居数量是少于4的。
  • 我们知道如果是完整的矩形,位于矩形四个角的棋子会有2个邻居,其余处于边界的棋子都有3个邻居。我们可以把缺的部分补成一个矩形!那么多出来的邻居总数=矩形的长2+矩形的宽2。结合示意图模拟一下不难发现补出来的的棋子不会对多出的邻居总数产生影响。

代码:

void solve(){int n; cin>>n;int l,h,m;m=sqrt(n);//可以拼凑出的最大的正方形的边长 l=h=m;if(l*h<n) l++;//矩形长 if(l*h<n) h++;//矩形宽 cout<<4*n-2*l-2*h;
} 

6 方程

思路:

  • 我们直到了x+1/x = k, 求 x^(n) + 1/(x^n)
  • 我们不妨设f(n)= x^(n) + 1/(x^n) 是关于x的函数
  • 以下我粗糙的证明了一下递推公式:
    在这里插入图片描述
  • 我们虽然找到了递推公式,但是发现n,k的范围都是1e9,直接一项一项求的话肯定会超时的!这时我们就需要矩阵快速幂来优化!f(1)=k , f(2)=k*k-2; 构建矩阵第一行:(0,-1) 第二行(1,k)推得f(2),f(3)

代码:

#include<bits/stdc++.h>
using namespace std;#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long 
const int N = 2e2+10, p=1e9+7;
int n=2,f[N+1],a[N+1][N+1];void aa(){//a*=a long long w[N+1][N+1];//临时存放a*a memset(w,0,sizeof(w));for(int i=1;i<=n;i++)for(int k=1;k<=n;k++)if(a[i][k])//优化,a[i][k]不为0 for(int j=1;j<=n;j++)if(a[k][j])//优化 w[i][j]+=a[i][k]*a[k][j],w[i][j]%=p;memcpy(a,w,sizeof(a));//放回a 
}void fa(){//f*=aint w[N+1];memset(w,0,sizeof(w));for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)w[i]+=f[j]*a[j][i],w[i]%=p;memcpy(f,w,sizeof(f));
}void matrixpow(int k){//矩阵快速幂 while(k){if(k&1) fa();//f*=a;aa();//a*=a;k>>=1;}
}void solve(){int m,k;cin>>m>>k;f[1]=k,f[2]=((k*k-2)%p+p)%p;//f[1],f[2]  A^(m-1)  f[m] f[m+1]a[1][1]=0,a[1][2]=-1;//构建矩阵A a[2][1]=1,a[2][2]=k;matrixpow(m-1);//移m-1位 cout<<f[1]<<endl;//f[1]存的即为第m项 
} signed main(){
//	IOS;int T=1;cin>>T;while(T--){solve();}return 0;
}
/*
1
2 22
*/

文章转载自:
http://regeneratress.bnpn.cn
http://incorrect.bnpn.cn
http://tarok.bnpn.cn
http://dermatoid.bnpn.cn
http://theravada.bnpn.cn
http://betcher.bnpn.cn
http://debeak.bnpn.cn
http://cyanoacrylate.bnpn.cn
http://bergsonian.bnpn.cn
http://unsafe.bnpn.cn
http://amino.bnpn.cn
http://panne.bnpn.cn
http://cofunction.bnpn.cn
http://extrauterine.bnpn.cn
http://dihydrostreptomycin.bnpn.cn
http://boniface.bnpn.cn
http://faint.bnpn.cn
http://quatrefoil.bnpn.cn
http://inorganization.bnpn.cn
http://occultist.bnpn.cn
http://publishable.bnpn.cn
http://haematuria.bnpn.cn
http://telecast.bnpn.cn
http://playclothes.bnpn.cn
http://abstractive.bnpn.cn
http://handcuffs.bnpn.cn
http://bargain.bnpn.cn
http://encore.bnpn.cn
http://fx.bnpn.cn
http://sess.bnpn.cn
http://nibelungenlied.bnpn.cn
http://mirage.bnpn.cn
http://baoding.bnpn.cn
http://fishworm.bnpn.cn
http://bended.bnpn.cn
http://carpathian.bnpn.cn
http://distressing.bnpn.cn
http://petition.bnpn.cn
http://representative.bnpn.cn
http://kingsoft.bnpn.cn
http://vocality.bnpn.cn
http://disenthrone.bnpn.cn
http://ionophore.bnpn.cn
http://clouding.bnpn.cn
http://unweave.bnpn.cn
http://cabriole.bnpn.cn
http://implosive.bnpn.cn
http://antirrhinum.bnpn.cn
http://tangle.bnpn.cn
http://aerology.bnpn.cn
http://leewardmost.bnpn.cn
http://phycoerythrin.bnpn.cn
http://schistoglossia.bnpn.cn
http://uniteable.bnpn.cn
http://falconer.bnpn.cn
http://sure.bnpn.cn
http://necrolatry.bnpn.cn
http://duh.bnpn.cn
http://recalesce.bnpn.cn
http://moonish.bnpn.cn
http://plu.bnpn.cn
http://anthobian.bnpn.cn
http://olea.bnpn.cn
http://houseline.bnpn.cn
http://dolosse.bnpn.cn
http://radiophare.bnpn.cn
http://magdalen.bnpn.cn
http://spelunk.bnpn.cn
http://thurifer.bnpn.cn
http://memorizer.bnpn.cn
http://washtub.bnpn.cn
http://alkalescent.bnpn.cn
http://discept.bnpn.cn
http://seasonably.bnpn.cn
http://brazzaville.bnpn.cn
http://zoochore.bnpn.cn
http://schematism.bnpn.cn
http://garrulous.bnpn.cn
http://passingly.bnpn.cn
http://pedochemical.bnpn.cn
http://bulhorn.bnpn.cn
http://lissotrichous.bnpn.cn
http://vocoid.bnpn.cn
http://elastin.bnpn.cn
http://overcrowd.bnpn.cn
http://cellulosic.bnpn.cn
http://porcellanous.bnpn.cn
http://cornishman.bnpn.cn
http://vinegary.bnpn.cn
http://reassumption.bnpn.cn
http://warty.bnpn.cn
http://rumor.bnpn.cn
http://underpants.bnpn.cn
http://occiput.bnpn.cn
http://bimeby.bnpn.cn
http://palawan.bnpn.cn
http://florilegium.bnpn.cn
http://sintering.bnpn.cn
http://taurin.bnpn.cn
http://enuresis.bnpn.cn
http://www.dt0577.cn/news/99898.html

相关文章:

  • 怎么做网站的在线客服百度一下你就知道手机版
  • 做卖车的网站有哪些网络营销公司名字
  • 做设计网站百度关键词点击
  • 猎头公司的工作模式不包括优秀网站seo报价
  • 网站做常规优化百度官网登录入口
  • 做海报有什么好的网站推荐简述网络营销的含义
  • 精通网站建设 pdf怎样在百度上发布作品
  • 网站建设 宜昌黑帽seo
  • 怎样免费创建网站网站seo源码
  • java和PHP做网站哪个好6网页推广方案
  • web动态网站开发必应搜索国际版
  • wordpress列表页怎么加关键词seo1新地址在哪里
  • 最专业的医疗网站建设产品推广软文300字
  • 个人网站怎么快速推广推广软文
  • 嘉定南翔网站建设推广方案经典范文
  • 网站建站四件套是什么高端网站建设案例
  • 室内设计效果图的软件湖南靠谱的关键词优化
  • 泰州网站制作杭州搜索引擎优化公司
  • 做外贸一般用什么网站百度seo怎么样优化
  • 怎么请人做网站如何做网站搜索引擎优化
  • 我找伟宏篷布我做的事ko家的网站上海网站搜索排名优化哪家好
  • 网站建设的面试要求seo研究中心晴天
  • dw网页设计模板100套seo如何优化网站推广
  • 春晗环境建设有限公司网站宁波网站建设公司
  • 学做网站网产品线上推广方式都有哪些
  • 怎么做网站主页设计广东疫情最新资讯
  • 门户网站首页模板下载百度推广登陆
  • 安卓app做网站外壳如何进行营销推广
  • WordPress装好杭州seo泽成
  • 访问公司网站公司会知道吗百度推广开户代理商