您的位置:首页 > 文旅 > 美景 > 无货源电商软件_专业营销策划团队_苏州百度推广开户_线上培训机构排名前十

无货源电商软件_专业营销策划团队_苏州百度推广开户_线上培训机构排名前十

2024/10/5 3:36:59 来源:https://blog.csdn.net/2301_79470071/article/details/142303383  浏览:    关键词:无货源电商软件_专业营销策划团队_苏州百度推广开户_线上培训机构排名前十
无货源电商软件_专业营销策划团队_苏州百度推广开户_线上培训机构排名前十

A - Jiro :

题目:

代码:

#include <bits/stdc++.h>using namespace std;typedef long long LL ;
typedef pair<int,int> PII;void solve()
{string a,b, c;cin>>a>>b>>c;string s(3,'a');s[0]=a[0];s[1]=b[0];s[2]=c[0];// a b c// c b a// b a c// c a b // a c b // b c aif(s[0]=='>' && s[1]=='>' && s[2]=='>') cout<<'B';else if(s[0]=='<' && s[1]=='<' && s[2]=='<') cout<<'B';else if(s[0]=='<' && s[1]=='>' && s[2]=='>') cout<<'A';else if(s[0]=='>' && s[1]=='<' && s[2]=='<') cout<<'A';else cout<<'C';}int main()
{int T;// cin>>T;T=1;while(T--){solve();}return 0;
}

B - Taro

题目:

代码:

#include <bits/stdc++.h>using namespace std;typedef long long LL ;
typedef pair<int,int> PII;void solve()
{int n,m;cin>>n>>m;vector<int> a(m);string b(m,' ');vector<int> h(n);for(int i=0; i<m; i++){cin>>a[i]>>b[i];a[i]--;if(b[i]=='M'){h[a[i]]++;}if(h[a[i]]==1 &&b[i]=='M') cout<<"Yes\n";else cout<<"No\n";}}int main()
{int T;// cin>>T;T=1;while(T--){solve();}return 0;
}

C - Make Isomorphic:

题目:

思路:

找到g i 与 h j 顶点的对应关系,枚举(1,..,n) 的全排列,计算每种排列对应的花费,取最小值.

代码:

#include <bits/stdc++.h>
using namespace std;typedef long long LL;
typedef pair<int,int> PII;void solve()
{int n;cin>>n;vector w(n,vector(n,0)),g(n,vector(n,0)), h(n,vector(n,0));int mg;cin>>mg;for(int i=0;i <mg; i++){int a, b;cin>>a>>b;a--, b--;g[a][b]=1;g[b][a]=1;}int mh;cin>>mh;for(int i=0; i<mh; i++){int a,b;cin>>a>>b;a--, b--;h[a][b]=1;h[b][a]=1;}for(int i=0; i<n; i++){for(int j=i+1; j<n; j++){cin>>w[i][j];}}vector<int> p(n);iota(p.begin(),p.end(),0);int ans=1e9;do{int res=0;for(int i=0;i<n; i++){for(int j=i+1; j<n; j++){if(h[i][j]!=g[p[i]][p[j]]){res+=w[i][j];}}}ans=min(ans,res);}while(next_permutation(p.begin(),p.end()));cout<<ans<<"\n";}int main()
{int T;
//	cin>>T;T=1;while(T--){solve();}return 0;
}

D - 1D Country:

题目:

思路:

离散化+二分查找

代码:

#include <bits/stdc++.h>using namespace std;typedef long long LL;int main()
{int n;cin>>n;vector<int> x(n+1), p(n+1);x[0]=-0x3f3f3f3f;for(int i=1; i<=n; i++) cin>>x[i];for(int i=1; i<=n; i++) cin>>p[i];vector<LL> s(n+1);for(int i=1; i<=n; i++){s[i]=s[i-1]+p[i];}int q;cin>>q;while(q--){int a,b;cin>>a>>b;int l=lower_bound(x.begin(), x.end(), a)-x.begin();int r=upper_bound(x.begin(), x.end(), b)-x.begin()-1;cout<<s[r]-s[l-1]<<'\n';}return 0;
}

E - I Hate Sigma Problems 

题目:

思路:

求每个Ai的贡献,

代码:

#include <bits/stdc++.h>using namespace std;typedef long long LL;int main()
{int n;cin>>n;vector<int> a(n+1);vector<vector<int>> pos(n+1);for(int  i=1; i<=n; i++){cin>>a[i];pos[a[i]].push_back(i);} LL ans=0;for(int i=1; i<=n; i++){int ls=0;for(auto j: pos[i]) ans+=1LL*(j-ls)*(n-j+1), ls=j;}cout<<ans<<'\n';
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com