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

建设网站的工作总结seo排名优化厂家

建设网站的工作总结,seo排名优化厂家,青岛品牌设计公司,昆明设计网站比赛链接:Dashboard - Codeforces Round 855 (Div. 3) - Codeforces A:模拟 题意:给定一个字符串,问这个字符串是不是猫叫。定义是猫叫得字符串: 1:必须由大写或小写得M(m),E&…

比赛链接:Dashboard - Codeforces Round 855 (Div. 3) - Codeforces

A:模拟 

题意:给定一个字符串,问这个字符串是不是猫叫。定义是猫叫得字符串:

1:必须由大写或小写得'M(m)','E(e)','O(o)','W(w)'组成

2:字符串起始必须是M(大写或者小写都行)紧跟其后必须是E,接着是O,接着是W,然后结束。

分析:根据条件,将字符串扫一遍即可

代码:

#include <bits/stdc++.h>
#define pi acos(-1)
#define int long long
#define PII pair<int,int>
#define all(v) v.begin(),v.end()
#define INF 0x3f3f3f3f3f3f3f3f
#define fs(a) cout<<fixed<<setprecision(a)<< //fs(4)(1.0/3)=0.3333//保留a位小数
#define read() freopen("input.txt","r",stdin)
#define output() freopen("output.txt","w",stdout)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2e5+10;
const int mod = 1e9+7;
const int Mod = 998244353;
int lowbit(int x){return x&(-x);}
int up(int a,int b){return a<0?a/b:(a+b-1)/b;}//       a/b向上取整
int quickpow(int a,int n){int ans=1;while(n){if(n&1){ans*=a,ans%=Mod;}a*=a;a%=Mod;n>>=1;}return ans;}//快速幂
int qc(int a,int b,int p){int ans=0;while(b){if(b&1){ans+=a,ans%=p;}a*=2;a%=p;b>>=1;}return ans;}//快速乘 a*b%pinline void solve(){int n,i=0;string s;cin>>n>>s;if(n<4||(s[0]!='M'&&s[0]!='m')){cout<<"NO\n";return;}while(s[i]=='M'||s[i]=='m') i++;if(s[i]!='E'&&s[i]!='e'){cout<<"NO\n";return;}while(s[i]=='E'||s[i]=='e') i++;if(s[i]!='O'&&s[i]!='o'){cout<<"NO\n";return;}while(s[i]=='O'||s[i]=='o') i++;if(s[i]!='W'&&s[i]!='w'){cout<<"NO\n";return;}while(s[i]=='W'||s[i]=='w') i++;if(i==n) cout<<"YES\n";else cout<<"NO\n"; 
}signed main(){fast;int T;cin>>T;while(T--) solve();
}              

 B:贪心

题意: 给定一个字符串,相同字符的大小写为一个匹配对(例如:Aa)。你可以使用任意次操作,使得将大写字母改为小写字母,或者小写字母改为大写字母。问最多有多少个匹配对

分析:我们发现,尽可能的使用完操作次数,我们才会得到最大匹配对数。我们只需要记录一下相同字母对应的大小写个数,然后可以先计算原始的匹配对,再计算操作后的匹配对数。具体看代码

#include <bits/stdc++.h>
#define pi acos(-1)
#define int long long
#define PII pair<int,int>
#define all(v) v.begin(),v.end()
#define INF 0x3f3f3f3f3f3f3f3f
#define fs(a) cout<<fixed<<setprecision(a)<< //fs(4)(1.0/3)=0.3333//保留a位小数
#define read() freopen("input.txt","r",stdin)
#define output() freopen("output.txt","w",stdout)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2e5+10;
const int mod = 1e9+7;
const int Mod = 998244353;
int lowbit(int x){return x&(-x);}
int up(int a,int b){return a<0?a/b:(a+b-1)/b;}//       a/b向上取整
int quickpow(int a,int n){int ans=1;while(n){if(n&1){ans*=a,ans%=Mod;}a*=a;a%=Mod;n>>=1;}return ans;}//快速幂
int qc(int a,int b,int p){int ans=0;while(b){if(b&1){ans+=a,ans%=p;}a*=2;a%=p;b>>=1;}return ans;}//快速乘 a*b%p
int u[N],l[N];inline void solve(){int n,k;string s;cin>>n>>k>>s;memset(u,0,sizeof u);memset(l,0,sizeof l);for(int i=0;i<n;i++){if(isupper(s[i])) u[s[i]-'A']++;else l[s[i]-'a']++;}int ans=0;for(int i=0;i<26;i++){int minn=min(u[i],l[i]);ans+=minn;u[i]-=minn;l[i]-=minn;if(u[i]>=2){if(u[i]/2<=k) ans+=u[i]/2,k-=u[i]/2;else ans+=k,k=0;}else if(l[i]>=2){if(l[i]/2<=k) ans+=l[i]/2,k-=l[i]/2;else ans+=k,k=0;}}cout<<ans<<"\n";
}signed main(){fast;int T;cin>>T;while(T--) solve();
}              

 C:模拟+贪心(大根堆)

 

题意:你的初始分数为0。给定一堆牌,每个牌有一定的数字,给定顺序去摸取。如果摸到非0牌,则可以选择将此牌放在自己牌堆的堆顶,或者放弃这张牌。如果摸到数字为0的牌,则自己牌堆堆顶的数字会加到你的分数里面,并且标记这张牌已经使用过,问你能得到的最大分数。

分析:根据题意,我们发现,在摸到非0牌之前,我们要将最大的数字放在堆顶,那么这是一个动态维护最大值的过程,因此我们可以使用大根堆。大根堆的pop()操作即为已经使用的牌。

代码:

#include <bits/stdc++.h>
#define pi acos(-1)
#define int long long
#define PII pair<int,int>
#define all(v) v.begin(),v.end()
#define INF 0x3f3f3f3f3f3f3f3f
#define fs(a) cout<<fixed<<setprecision(a)<< //fs(4)(1.0/3)=0.3333//保留a位小数
#define read() freopen("input.txt","r",stdin)
#define output() freopen("output.txt","w",stdout)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2e5+10;
const int mod = 1e9+7;
const int Mod = 998244353;
int lowbit(int x){return x&(-x);}
int up(int a,int b){return a<0?a/b:(a+b-1)/b;}//       a/b向上取整
int quickpow(int a,int n){int ans=1;while(n){if(n&1){ans*=a,ans%=Mod;}a*=a;a%=Mod;n>>=1;}return ans;}//快速幂
int qc(int a,int b,int p){int ans=0;while(b){if(b&1){ans+=a,ans%=p;}a*=2;a%=p;b>>=1;}return ans;}//快速乘 a*b%p
int a[N];inline void solve(){int n;cin>>n;priority_queue<int>q;for(int i=1;i<=n;i++) cin>>a[i];int ans=0,cnt=1;while(1){if(cnt>n) break;while(cnt<=n&&a[cnt]!=0) q.push(a[cnt++]);while(cnt<=n&&a[cnt]==0){if(!q.size()){cnt++;continue;}else{ans+=q.top();q.pop();cnt++;}}}cout<<ans<<"\n";
}signed main(){fast;int T;cin>>T;while(T--) solve();
}              

D:思维

题意:给定字符串 s,你可以移除其中两个连续的字母。问操作之后你所能得到的不同字符串的数量是多少

分析:我们发现,如果这样一组字符串:aba,那么删掉两个相邻的元素,所得的结果串是一样的。那么我们可以得出一个结论:如果s[i]==s[i+2],那么就说明有一个重复串的出现。

此外还有一个结论可以从样例得出:如果一个长度为n的串所含的不同字符个数为n,那么可以得到n-1个不同的串。因此,我们只需要减掉重复串的个数即可。

代码:

#include <bits/stdc++.h>
#define pi acos(-1)
#define int long long
#define PII pair<int,int>
#define all(v) v.begin(),v.end()
#define INF 0x3f3f3f3f3f3f3f3f
#define fs(a) cout<<fixed<<setprecision(a)<< //fs(4)(1.0/3)=0.3333//保留a位小数
#define read() freopen("input.txt","r",stdin)
#define output() freopen("output.txt","w",stdout)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2e5+10;
const int mod = 1e9+7;
const int Mod = 998244353;
int lowbit(int x){return x&(-x);}
int up(int a,int b){return a<0?a/b:(a+b-1)/b;}//       a/b向上取整
int quickpow(int a,int n){int ans=1;while(n){if(n&1){ans*=a,ans%=Mod;}a*=a;a%=Mod;n>>=1;}return ans;}//快速幂
int qc(int a,int b,int p){int ans=0;while(b){if(b&1){ans+=a,ans%=p;}a*=2;a%=p;b>>=1;}return ans;}//快速乘 a*b%p
int a[N];inline void solve(){int n;string s;cin>>n>>s;int ans=0;for(int i=0;i<n-2;i++){if(s[i]==s[i+2]) ans++;}cout<<n-ans-1<<"\n";
}signed main(){fast;int T;cin>>T;while(T--) solve();
}              

 E:思维

题意:给定两个字符串和k,字符串可以将下标 和|i−j|=k和|i−j|=k+1 得两个字符 ,ai,aj 发生交换

分析:通过手撸样例可以发现:如果当n=5,k=3的时候,满足条件的点为:[1,4],[1,5],[2,5]。然后你会发现:点1,2,4,5的位置可以任意交换。位置3则不能交换。所以思路很显然了。

首先判断两个字符串中包含的字符数是否相同,再判断不能交换位置的点上的字符是否相同。

代码:

#include <bits/stdc++.h>
#define pi acos(-1)
#define int long long
#define PII pair<int,int>
#define all(v) v.begin(),v.end()
#define INF 0x3f3f3f3f3f3f3f3f
#define fs(a) cout<<fixed<<setprecision(a)<< //fs(4)(1.0/3)=0.3333//保留a位小数
#define read() freopen("input.txt","r",stdin)
#define output() freopen("output.txt","w",stdout)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=2e5+10;
const int mod = 1e9+7;
const int Mod = 998244353;
int lowbit(int x){return x&(-x);}
int up(int a,int b){return a<0?a/b:(a+b-1)/b;}//       a/b向上取整
int quickpow(int a,int n){int ans=1;while(n){if(n&1){ans*=a,ans%=Mod;}a*=a;a%=Mod;n>>=1;}return ans;}//快速幂
int qc(int a,int b,int p){int ans=0;while(b){if(b&1){ans+=a,ans%=p;}a*=2;a%=p;b>>=1;}return ans;}//快速乘 a*b%pinline bool pd(string a,string b){map<char,int>mp1,mp2;for(int i=0;i<a.size();i++) mp1[a[i]]++;for(int i=0;i<b.size();i++) mp2[b[i]]++;for(auto x:a){if(mp1[x]!=mp2[x]) return false;}return true;
}inline void solve(){int n,k;string s,t;cin>>n>>k>>s>>t;if(!pd(s,t)){cout<<"NO\n";return;}bool ok=true;for(int i=0;i<n;i++){if(i<k&&n-i-1<k&&s[i]!=t[i]){ok=false;break;}}if(ok) cout<<"YES\n";else cout<<"NO\n";
}signed main(){fast;int T;cin>>T;while(T--) solve();
}              

http://www.15wanjia.com/news/7509.html

相关文章:

  • 网站公安备案怎么备案关键词seo排名怎么选
  • 做网站开发多少钱seo排名优化有哪些
  • app设计思路合肥网络优化推广公司
  • 用路由侠做网站东莞网络推广托管
  • 哪些专门做批发的网站有哪些微信如何引流推广精准加人
  • phpcms v9漏洞网络seo是什么意思
  • 做网站备负责人风险大吗百度竞价排名叫什么
  • 成都免费建网站海外推广代理公司
  • 织梦网站建设博客百度电话人工服务
  • 备案通过 网站打不开免费建设网站平台
  • 网站颜色产品推广方法有哪些
  • 工业企业网站建设也的意义郑州seo使用教程
  • 网站建设系统怎么样电商卖货平台有哪些
  • 网站制作需求文档百度一下你就知道了百度
  • 建设厅网站上企业登录广州seo好找工作吗
  • 网站综合开发怎么做手机制作网页
  • 政府网站建设进度互联网广告价格
  • 网上那个网站做席子批发怎样在百度上打广告
  • 青岛永诚网络有限公司厦门seo关键词
  • 网站公司如何推广网站惠州seo优化
  • 西宁网站建设优化营商环境的措施建议
  • 嘉兴seo报价seo优化网络公司
  • 视频直播网站怎么做软文代写接单平台
  • 网站挂马怎么办网址收录查询
  • 网页设计自学网站seo免费工具
  • 重庆市建设工程施工安全管理总站淘宝seo软件
  • icp备案网站建设方案书网络营销策划书结构
  • 大连广告设计与制作公司贵州百度seo整站优化
  • 怎样做淘宝联盟的网站代发推广百度首页包收录
  • ps做网站心得石家庄新闻头条新闻最新今天