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

做网站是用myecli推广咨询服务公司

做网站是用myecli,推广咨询服务公司,真人seo点击平台,如何做自己网站平台目录 A. Rook 问题分析: B. YetnotherrokenKeoard 问题分析: C. Removal of Unattractive Pairs 问题分析: D. Jumping Through Segments 问题分析: E. Good Triples 问题分析: A. Rook 问题分析: 给一个棋子将其同行同列的位置输出 #include<bits/s…

目录

A. Rook 

问题分析: 

B. YetnotherrokenKeoard

问题分析:  

C. Removal of Unattractive Pairs

问题分析:  

D. Jumping Through Segments

问题分析:  

E. Good Triples

问题分析:  


A. Rook 

问题分析: 

给一个棋子将其同行同列的位置输出

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 0x3f3f3f3f
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin(),a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using namespace std;
typedef pair<int,int>pii;
const int N =1e5+7;
signed main()
{IOS
use{string a;cin>>a;char x=a[0];int num=a[1]-'0';for(int i=1;i<=8;i++){if(i!=num)cout<<x<<i<<endl;}for(int i=0;i<=7;i++){if('a'+i!=x){cout<<(char)('a'+i)<<num<<endl;}}}return 0;
}

B. YetnotherrokenKeoard

 

问题分析:  

一个字符串,当当前字符为'b'时,删除新字符串最右边的 小写字符,当当前字符为'B'时删除新字符串最右边的大写字符,没有则不删除,除去'b'和'B'的其他字符添加到新字符串当中,然后输出。

可以通过栈来存储新字符串当中的大小写字符的位置,然后遇到相应的'b' or 'B',将栈顶的位置标记,最后按照标记输出原字符串的字符即可

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 0x3f3f3f3f
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin(),a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using namespace std;
typedef pair<int,int>pii;
const int N =1e5+7;
signed main()
{IOS
use{string a;cin>>a;stack<int>lowi,upi;vct<bool>st(a.LEN);for(int i=0;i<a.LEN;i++){if(a[i]=='b'){st[i]=1;if(lowi.empty())continue;else st[lowi.top()]=1,lowi.pop();}else if(a[i]=='B'){st[i]=1;if(upi.empty())continue;else st[upi.top()]=1,upi.pop();}else {if(islower(a[i])){lowi.push(i);}else {upi.push(i);}}}for(int i=0;i<a.LEN;i++){if(!st[i])cout<<a[i];}cout<<"\n";
}return 0;
}

C. Removal of Unattractive Pairs

 

问题分析:  

 给定字符串,如果相邻两个字符不同,可以删除这两个字符,求出最终可以剩下几个字符

我们统计每个字符的数量,为了保证最后剩下的字符个数最少,我们贪心地用个数次大的字符与个数最大的字符相抵消,因为需要维护数量的降序排序,我们选择使用大根堆来维护,我们每次弹出堆顶的两个元素,将他们互相抵消,也就是都减一,如果大于零就再放回堆当中,最终堆内会只剩下一个数,也就是最短的字符串长度

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 0x3f3f3f3f
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin(),a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using namespace std;
typedef pair<int,int>pii;
const int N =1e5+7;
signed main()
{IOS
use{int n;cin>>n;string a;cin>>a;vct<int>cnt(26);for(int i=0;i<a.LEN;i++){cnt[a[i]-'a']++;}priority_queue<int>q;for(int i=0;i<26;i++){if(cnt[i]!=0)q.push(cnt[i]);}while(q.size()>1){int x=q.top();q.pop();int y=q.top();q.pop();x--;y--;if(x>0)q.push(x);if(y>0)q.push(y);}if(q.empty())cout<<"0"<<endl;else cout<<q.top()<<endl;
}return 0;
}

D. Jumping Through Segments

 

问题分析:  

 n个线段,每次可以选择走0~k格,第i次一定要落在第i个线段内部,要求在满足条件的情况下使得k最小.

对于k来说,k的大小对于结果的影响是单调的,故可以用二分答案,我们只需要确定第i步走出的范围能够与第i个线段有交集即可

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 0x3f3f3f3f
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin(),a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using namespace std;
typedef pair<int,int>pii;
const int N =1e5+7;
signed main()
{IOSuse{int n;cin >> n;int ans;vct<int> l(n + 1);vct<int> r(n + 1);for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];int L = 0, R = 1e9;int mid;auto check = [&](int mid) -> bool {int dis1 = 0, dis2 = 0;for (int i = 1; i <= n; i++) {dis1 -= mid, dis2 += mid;if (dis1 > r[i] || dis2 < l[i]) return false;mmax(dis1, l[i]), mmin(dis2, r[i]);}return true;};while (L <= R) {mid = (L + R) >> 1;if (check(mid)) {R = mid - 1;ans = mid;} else L = mid + 1;}cout << ans << endl;}return 0;
}

E. Good Triples

 

问题分析:  

给定整数n,求出有多少个三元组满足题目条件,且若三元组的元素相同但排序不同,则 算是不同的三元组。

我们通过样例以及向下推导可知:

故满足[(n+2)\times (n+1)\div2 ]的公式,且为n各位数字得到结果的乘积

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 0x3f3f3f3f
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin(),a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using namespace std;
typedef pair<int,int>pii;
const int N =1e5+7;
signed main()
{IOSuse{string a;cin>>a;int ans=1;for(int i=0;i<a.LEN;i++){ans*=(a[i]-'0'+2)*(a[i]-'0'+1)/2;}cout<<ans<<endl;}return 0;
}

 

http://www.yidumall.com/news/102976.html

相关文章:

  • 百度seo服务佛山seo
  • 个人网站免费源码西安seo专员
  • 网站建设后续需要维护百度关键词价格排行榜
  • 建筑人才网招聘电气工程师搜索引擎优化的特点
  • 网站群集建设网络营销推广方案ppt
  • 地方网站怎么做挣钱北京seo产品
  • 做外墙资料的网站苏州搜索引擎优化
  • 做网站到底要不要备案优化营商环境心得体会个人
  • 经营网站 备案磁力库
  • 做投资的网站网络营销能干什么工作
  • 制作个网站多少钱西安百度网站快速优化
  • 自己做商品网站怎么做seo是什么职位简称
  • 做印尼购物网站如何发货百度seo软件是做什么的
  • 建设网站目的最佳bt磁力狗
  • 网站10月份可以做哪些有意思的专题google搜索引擎下载
  • 信阳搜索引擎优化关键词优化收费标准
  • 帮网贷做网站会判刑吗淘宝指数转换
  • 开一家网站建设公司有前景吗上海短视频seo优化网站
  • 做网站的客服回访话术惠州seo按天计费
  • 企业网站现状分析seo是什么工作
  • 辽宁住房和城乡建设网站seo关键词优化公司
  • 在线制作动画的网站广告推广赚钱
  • 河南建设网站信息查询中心做百度推广销售怎么样
  • 中山高端网站建设价格企业宣传推广方案
  • 做web网站有前途吗天津seo排名费用
  • 给公司做网站的费用入什么科目简述常用的网络营销方法
  • 外贸网站建设推广公司长沙seo外包
  • 博望哪里做网站竞价推广平台有哪些
  • 台式机做网站服务器seo技术优化
  • 工信部网站备案方法昆明排名优化