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

雅联网站建设深圳建溢公司招聘

雅联网站建设,深圳建溢公司招聘,手机做logo用什么网站,网站建设都用那些软件A题 题目链接#xff1a;https://codeforces.com/problemset/problem/1833/A 基本思路#xff1a;for循环遍历字符串s#xff0c;依次截取字符串s的子串str#xff0c;并保存到集合中#xff0c;最后输出集合内元素的数目即可 AC代码#xff1a; #include iostrea…A题 题目链接https://codeforces.com/problemset/problem/1833/A 基本思路for循环遍历字符串s依次截取字符串s的子串str并保存到集合中最后输出集合内元素的数目即可 AC代码 #include iostream #include algorithm #include string #include set using namespace std; typedef long long ll; typedef long double db; void solve() {setstringst;int n;cin n;string s;cin s;for (int i 0; i n - 1; i){string str s.substr(i, 2);st.insert(str);}cout st.size() endl; } int main() {int t;cin t;while (t--){solve();}return 0; } B题 题目链接https://codeforces.com/problemset/problem/1833/B 基本思路可以使用结构体与快速排序来解题。第一用结构体p来存储数组a和其对应的原始位置id并为数组b预留出变量c这个位置。第二先对结构体进行排序若a的值相同则id小的排在前面。第三对数组b进行排序。第四讲排序后的数组b的值依次赋值给结构体中的变量c。最后将结构体根据id恢复其原来的排序最后使用for循环遍历依次输出c即可。 AC代码 #include iostream #include algorithm using namespace std; typedef long long ll; typedef long double db; ll b[100005]; struct nodes {ll a;int id;ll c; }p[100005]; bool cmp(nodes x, nodes y) {if (x.a y.a)return x.id y.id;return x.a y.a; } bool kmp(nodes x, nodes y) {return x.id y.id; } void solve() {int n, k;cin n k;for (int i 1; i n; i){cin p[i].a;p[i].id i;}for (int i 1; i n; i){cin b[i];}sort(p 1, p 1 n, cmp);sort(b 1, b 1 n);for (int i 1; i n; i)p[i].c b[i];sort(p 1, p 1 n, kmp);for (int i 1; i n; i)cout p[i].c ;cout endl; } int main() {int t;cin t;while (t--){solve();}return 0; } C题 题目链接https://codeforces.com/problemset/problem/1833/C 基本思路因为奇数与奇数相减为偶数偶属于偶数相减为偶数奇数与偶数相减只能为奇数。所以想要数组a变成全是偶数或者全是奇数的序列序列有奇有偶奇数的最小值必须比偶数的最小值小整个序列才可以变为全奇数的序列不可能变成全偶数。 AC代码 #include iostream #include algorithm using namespace std; typedef long long ll; typedef long double db; int a[200005]; void solve() {int n;cin n;for (int i 1; i n; i)cin a[i];int ou 0, ji 0, minou 1e9, minji 1e9;for (int i 1; i n; i){if (a[i] 1){ji;minji min(minji, a[i]);}else{ou;minou min(minou, a[i]);}}if (ji 0 ou 0 minou minji){cout NO endl;}else{cout YES endl;} } int main() {int t;cin t;while (t--){solve();}return 0; } D题 题目链接https://codeforces.com/problemset/problem/1833/D 基本思路因为要获得操作之后字典序最大的排列所以我们要想方设法地将p[2]到p[n]之间最大的数maxx放到最前面。我们不妨设置low和high两个左右指针。当p[n]maxx时high指向p[n], 当的时候high指向maxx的前一个元素。再设置一个指针op指向p[1]因为在将low到high之间的元素转换之后low左边的元素会转移到后方。因此为了使操作完成之后的排列尽可能地大我们可以先将low指向high如果p[low-1]p[op],则将low指针左移这样便可保证操作之后的排列的字典序最大。 AC代码 #include iostream #include algorithm using namespace std; typedef long long ll; typedef long double db; int p[2005]; void solve() {int n;cin n;for (int i 1; i n; i)cin p[i];int maxx n;if (p[1] maxx){maxx--;}if (p[n] maxx){int op 1, low n, r n;while (p[low - 1] p[op])low--;for (int i r; i low; i--)cout p[i] ;for (int i 1; i low; i)cout p[i] ;cout endl;return;}int r 1;for(int i1;in;i)if (p[i] maxx){r i - 1;break;}int op 1, low r;while (p[low - 1] p[op])low--;for (int i r 1; i n; i)cout p[i] ;for (int i r; i low; i--)cout p[i] ;for (int i 1; i low; i)cout p[i] ;cout endl; } int main() {int t;cin t;while (t--){solve();}return 0; } E题 题目链接https://codeforces.com/problemset/problem/1833/E 基本思路可以使用并查集来求解。用并查集将其分为多少个组最大值便是多少。因为每两个度为1的点可以合成一块所以用变量ans来统计一下度为1的点最后计算得到最小值的数量 AC代码 #include iostream #include algorithm #include string #include map using namespace std; typedef long long ll; typedef long double db; typedef pairint, intpii; mappii, boolmp; int f[200005], a[200005], du[200005]; int find(int x)//并查集认爹函数路径压缩 {if (x ! f[x])f[x] find(f[x]);return f[x]; } void solve() {int n;cin n;for (int i 1; i n; i){cin a[i];}mp.clear();for (int i 1; i n; i){f[i] i;du[i] 0;}for (int i 1; i n; i){if (mp[{i, a[i]}] false mp[{a[i], i}] false){du[a[i]];du[i];f[find(i)] find(a[i]);mp[{i, a[i]}] true;mp[{a[i], i}] true;}}int maxx 0, ans 0;for (int i 1; i n; i){if (find(i) i)maxx;if (du[i] 1)ans;}int minn min(maxx, maxx - ans / 2 1);cout minn maxx endl; } int main() {int t;cin t;while (t--){solve();}return 0; }
http://www.hkea.cn/news/14381300/

相关文章:

  • 做网站大概需要多少费用京东云
  • 企业网站建设可行性分析 技能训练广告设计培训班学校有哪些
  • 做网站下导航字号为多大凡科网做音乐网站
  • 个人网站建设安全开发微信小程序公司
  • 深圳住建厅官方网站怎么在网络推广自己的产品
  • 多种网站锦州网站制作
  • 免费网站建设合同书网站营销推广培训
  • 南京外贸网站建站企业宣传网站案例
  • 建站平台代理海伦市网站
  • 南山网站开发免费的网站加速器
  • 免费素材网站pexels婚纱网站源码
  • 公益网站建设方案优化是什么意思网络用语
  • 微信上的网站海口网站制作策划
  • 南宁共建站网站建设:博采网络
  • 南京市玄武区建设局网站新氧整形网站开发模版
  • 鲜花网站建设的目标莞城微网站建设
  • 网站建设遇到的问题及解决方法点击网站首页域名又添加一个
  • 网站建设中山优化如何取消wordpress页脚
  • 网站 可信验证如何做网站咨询
  • 建行手机网站网址是多少钱oa系统下载
  • 上海微网站公司WordPress怎么输入代码
  • 导购网站开发提供镇江网站建设
  • 网站登录页面html模板嘉兴网络建设
  • 系统软件开发公司龙岩优化公司
  • jsp网站源码 怎么用聊城市 网站制作
  • 怎么开发创建网站教程两个wordpress用户
  • vs2013 网站建设个人备案网站
  • wordpress page style专业优化网站排名
  • 张家口市建设局网站焦作建设网站
  • 个人网站建设规划案例新手php网站建设