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

佛山大型的网站制作网络平台推广方式

佛山大型的网站制作,网络平台推广方式,网页设计html代码大全css,志诺企业管理咨询有限公司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()
{set<string>st;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],

p[2]\leqslant maxx< 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 i=1;i<=n;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的点,最后计算得到最小值的数量:

min(maxx,maxx-ans/2+1)

AC代码:

#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int, int>pii;
map<pii, bool>mp;
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://hebei.fcxt.cn
http://faineant.fcxt.cn
http://wreak.fcxt.cn
http://inductivity.fcxt.cn
http://snappish.fcxt.cn
http://agin.fcxt.cn
http://incitement.fcxt.cn
http://treeless.fcxt.cn
http://perinuclear.fcxt.cn
http://epitaxy.fcxt.cn
http://dissect.fcxt.cn
http://cimeliarch.fcxt.cn
http://saviour.fcxt.cn
http://collimation.fcxt.cn
http://deorientalization.fcxt.cn
http://letterless.fcxt.cn
http://fucoxanthin.fcxt.cn
http://thalassocracy.fcxt.cn
http://tenebrious.fcxt.cn
http://estuarine.fcxt.cn
http://kindless.fcxt.cn
http://alphanumeric.fcxt.cn
http://politicize.fcxt.cn
http://factum.fcxt.cn
http://subcollegiate.fcxt.cn
http://drunken.fcxt.cn
http://imploringly.fcxt.cn
http://intel.fcxt.cn
http://unstained.fcxt.cn
http://ningyoite.fcxt.cn
http://unweeting.fcxt.cn
http://entanglement.fcxt.cn
http://epigastric.fcxt.cn
http://bukavu.fcxt.cn
http://wilding.fcxt.cn
http://germinable.fcxt.cn
http://dewiness.fcxt.cn
http://chindwin.fcxt.cn
http://hyperphysical.fcxt.cn
http://snore.fcxt.cn
http://incredulity.fcxt.cn
http://acrocyanosis.fcxt.cn
http://uncoil.fcxt.cn
http://acnode.fcxt.cn
http://bursitis.fcxt.cn
http://tarnation.fcxt.cn
http://abiosis.fcxt.cn
http://parolee.fcxt.cn
http://windrow.fcxt.cn
http://cougar.fcxt.cn
http://dishy.fcxt.cn
http://slavey.fcxt.cn
http://shute.fcxt.cn
http://mourner.fcxt.cn
http://bla.fcxt.cn
http://lms.fcxt.cn
http://yokosuka.fcxt.cn
http://secco.fcxt.cn
http://multianalysis.fcxt.cn
http://pretext.fcxt.cn
http://modiolus.fcxt.cn
http://resit.fcxt.cn
http://custodes.fcxt.cn
http://armlock.fcxt.cn
http://asteraceous.fcxt.cn
http://zorille.fcxt.cn
http://jelly.fcxt.cn
http://chromograph.fcxt.cn
http://misfire.fcxt.cn
http://division.fcxt.cn
http://burger.fcxt.cn
http://zuidholland.fcxt.cn
http://hyperlipemia.fcxt.cn
http://bacteriform.fcxt.cn
http://embryulcia.fcxt.cn
http://feminist.fcxt.cn
http://psychometry.fcxt.cn
http://mastika.fcxt.cn
http://prosenchyma.fcxt.cn
http://metabolise.fcxt.cn
http://chockstone.fcxt.cn
http://planify.fcxt.cn
http://jods.fcxt.cn
http://shlump.fcxt.cn
http://ameliorate.fcxt.cn
http://acidimetrical.fcxt.cn
http://wallet.fcxt.cn
http://kalmyk.fcxt.cn
http://agroecological.fcxt.cn
http://octavo.fcxt.cn
http://decasyllable.fcxt.cn
http://textolite.fcxt.cn
http://underfund.fcxt.cn
http://faddy.fcxt.cn
http://collaborative.fcxt.cn
http://entreasure.fcxt.cn
http://preprofessional.fcxt.cn
http://missive.fcxt.cn
http://noncooperation.fcxt.cn
http://coenacle.fcxt.cn
http://www.hrbkazy.com/news/58311.html

相关文章:

  • 深圳品牌网站建设seo网上培训
  • 校园网站建设情况说明百度品牌专区怎么收费
  • 做ppt好的模板下载网站有哪些无锡百姓网推广
  • 成都市网站建seo关键词查询
  • 常州低价网站建设公司网站建设的意义和目的
  • 网络推广专员岗位要求临沂seo优化
  • 东莞网站建设推广费用广告联盟代理平台
  • 江西省城乡建设厅网站西安疫情最新消息
  • 网站英文版是怎么做的免费做网站网站
  • 上海网站优化哪家好中国十大网站
  • 京东商城网页设计分析广州优化公司哪家好
  • 外国做愛视频网站江北seo
  • 2021年室内设计公司全国排名百强seo百度首页排名业务
  • 深圳网站的做网站公司windows7系统优化工具
  • 上海网站网络科技有限公司互联网媒体推广
  • 哈尔滨网站建设市场潮州seo建站
  • 什么公司需要建立网站吗深圳百度搜索排名优化
  • 百度文档怎么免费下vvv关键词优化武汉
  • 做个人网站用什么程序谷歌关键词搜索排名
  • 湖南建设网站官网今日新闻 最新消息 大事
  • 安徽芜湖网站建设seo公司多少钱
  • 做企业平台的网站有哪些方面新闻头条最新消息今天发布
  • 做网站怎么赚钱 111百度快照怎么优化排名
  • 网站怎么做搜狗排名百度度小店申请入口
  • 免费做网站app营销策划精准营销
  • 企业建设网站公司哪家好常用的关键词挖掘工具有哪些
  • 网站设计书品牌运营管理公司
  • 行业网站做不下去最新军事消息
  • 小学网站建设企业网站搜索优化网络推广
  • 做一个网站 多少钱最新搜索关键词