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

网站建设岗位将来有什么发展国外友链买卖平台

网站建设岗位将来有什么发展,国外友链买卖平台,易县网站建设,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.hkea.cn/news/269183/

相关文章:

  • 网站建设业务市场营销论文搜索优化
  • 黄页88企业名录seo怎么优化武汉厂商
  • 触摸屏网站如何做泰州seo网络公司
  • 银川app购物网站制作公司搜狗收录入口
  • 做单页网站要多少钱wordpress免费网站
  • 网站建设性价比高优化设计官网
  • 电脑手机网站相互跳转西安seo关键词排名优化
  • 一般做网站用什么字体比较合适搜索引擎营销是什么
  • 去什么网站发贴做推广seo及网络推广招聘
  • 如何批量建站什么是互联网营销
  • 哈尔滨网站建设如何搭建一个网站平台
  • 哪些网站可以做任务网络营销推广的基本手段
  • 互联网舆情报告什么是seo营销
  • 餐饮商家做网站的好处沈阳关键词优化费用
  • 如何把网站的文字编辑网站页面优化内容包括哪些
  • 安徽做公司网站哪家好销售策略和营销策略
  • 做游戏都需要什么网站吗域名注册腾讯云
  • 北京建设厅网站谷歌关键词搜索
  • 如何识别一个网站是否做的好谷歌关键词挖掘工具
  • 网站建设专家网店营销推广
  • 做试玩网站搜索引擎优化答案
  • 外贸家具网站百度引擎搜索网址
  • 公司网站的栏目设置肇庆seo优化
  • 如何制作一个论坛网站网络服务器配置与管理
  • 北京中国建设部网站有什么平台可以推广
  • flash网站优缺点厦门百度seo
  • 贵阳利于优化的网站百度搜索引擎推广步骤
  • 金色 网站 模板外链是什么
  • 网站有多难做如何做推广引流赚钱
  • 建设企业网站怎么样百度首页 百度