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

展示型网站建设多少钱域名和网站一样吗

展示型网站建设多少钱,域名和网站一样吗,个人网站备案名称 技巧,西安是哪个省属于哪个市Swap and Reverse 题面翻译 题目描述 本题共有 t t t 组数据。 给定一个长度为 n n n 的字符串 s s s 和一个整数 k k k#xff0c; s s s 只包含小写字母#xff0c;你可以进行若干次操作#xff08;可以是零次#xff09;#xff0c;具体操作如下#xff1a; 选…Swap and Reverse 题面翻译 题目描述 本题共有 t t t 组数据。 给定一个长度为 n n n 的字符串 s s s 和一个整数 k k k s s s 只包含小写字母你可以进行若干次操作可以是零次具体操作如下 选取一个 i i i 1 ≤ i ≤ n − 2 1\le i\le n-2 1≤i≤n−2交换 a i a_i ai​ 和 a i 2 a_{i2} ai2​ 选取一个 i i i 1 ≤ i ≤ n − k 1 1\le i\le n-k1 1≤i≤n−k1翻转区间 s [ i , i k − 1 ] s_{[i,ik-1]} s[i,ik−1]​。如果 s s 1 , s 2 , … , s i − 1 , s i , s i 1 , … , s i k − 2 , s i k − 1 , s i k , … , s n − 1 , s n ss_1,s_2,\dots,s_{i-1},s_i,s_{i1},\dots,s_{ik-2},s_{ik-1},s_{ik},\dots,s_{n-1},s_n ss1​,s2​,…,si−1​,si​,si1​,…,sik−2​,sik−1​,sik​,…,sn−1​,sn​可将其改为 s s 1 , s 2 , … , s i − 1 , s i k − 1 , s i k − 2 , … , s i 1 , s i , s i k , … , s n − 1 , s n ss_1,s_2,\dots,s_{i-1},s_{ik-1},s_{ik-2},\dots,s_{i1},s_i,s_{ik},\dots,s_{n-1},s_n ss1​,s2​,…,si−1​,sik−1​,sik−2​,…,si1​,si​,sik​,…,sn−1​,sn​ 输出经过若干次操作后得到的的按字典顺序排列的最小字符串。 输入格式 第一行包含一个正整数 t t t具体含义见上。 第二行包含两个正整数 n n n 和 k k k。 接下来一行 包含一个长度为 n n n 的字符串 s s s。 输出格式 对于每个测试用例在进行若干次操作后输出按字典顺序排列的最小字符串。 数据范围 1 ≤ t ≤ 1 0 4 , 1 ≤ k ≤ n ≤ 1 0 5 1\le t\le10^4,1\le k\le n\le10^5 1≤t≤104,1≤k≤n≤105。 Translate by Moss_spresd 题目描述 You are given a string $ s $ of length $ n $ consisting of lowercase English letters, and an integer $ k $ . In one step you can perform any one of the two operations below: Pick an index $ i $ ( $ 1 \le i \le n - 2 $ ) and swap $ s_{i} $ and $ s_{i2} $ .Pick an index $ i $ ( $ 1 \le i \le n-k1 $ ) and reverse the order of letters formed by the range $ [i,ik-1] $ of the string. Formally, if the string currently is equal to $ s_1\ldots s_{i-1}s_is_{i1}\ldots s_{ik-2}s_{ik-1}s_{ik}\ldots s_{n-1}s_n $ , change it to $ s_1\ldots s_{i-1}s_{ik-1}s_{ik-2}\ldots s_{i1}s_is_{ik}\ldots s_{n-1}s_n $ . You can make as many steps as you want (possibly, zero). Your task is to find the lexicographically smallest string you can obtain after some number of steps. A string $ a $ is lexicographically smaller than a string $ b $ of the same length if and only if the following holds: in the first position where $ a $ and $ b $ differ, the string $ a $ has a letter that appears earlier in the alphabet than the corresponding letter in $ b $ . 输入格式 Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^4 $ ). The description of the test cases follows. The first line of each test case contains two integers $ n $ and $ k $ ( $ 1 \le k n \le 10^5 $ ). The second line of each test case contains the string $ s $ of length $ n $ consisting of lowercase English letters. It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 10^5 $ . 输出格式 For each test case, print the lexicographically smallest string after doing some (possibly, zero) steps. 样例 #1 样例输入 #1 5 4 2 nima 5 3 panda 9 2 theforces 7 3 amirfar 6 4 rounds样例输出 #1 aimn aandp ceefhorst aafmirr dnorsu提示 In the first test case, we can obtain the string “aimn” using the following operations: Reverse the range $ [3,4] $ . The string turns into “niam”.Swap $ s_1 $ and $ s_3 $ . The string turns into “ainm”.Reverse the range $ [3,4] $ . The string turns into “aimn”. It can be proven that we cannot obtain any string lexicographically smaller than “aimn”. Therefore, “aimn” is the answer. In the second test case, we can obtain the string “aandp” using the following operations: Swap $ s_3 $ and $ s_5 $ . The string turns into “paadn”.Swap $ s_1 $ and $ s_3 $ . The string turns into “aapdn”.Swap $ s_3 $ and $ s_5 $ . The string turns into “aandp”. It can be proven that we cannot obtain any string lexicographically smaller than “aandp”. Therefore, “aandp” is the answer. 题目大意 两种操作后能得到的字典序排列最小的字符串 解题思路 观察这两种操作 交换 a i a_{i} ai​ 和 $ a_{i2} $ 可以得出此操作为交换距离为 2 2 2 的位数操作即偶数位可以互换 奇数位可以互换。 此时我们观察第二种操作选取一个 i i i 1 ≤ i ≤ n − k 1 1\le i\le n-k1 1≤i≤n−k1翻转区间 s [ i , i k − 1 ] , s_{[i,ik-1]}, s[i,ik−1]​, s s 1 , s 2 , s i − 1 , s i , s i 1 , , ˙ s i k − 2 , s i k − 1 , s i k , … , s n − 1 , s n ss_1,s_2,s_{i-1},s_i,s_{i1},\dot,s_{ik-2},s_{ik-1},s_{ik},\dots,s_{n-1},s_n ss1​,s2​,si−1​,si​,si1​,,˙​sik−2​,sik−1​,sik​,…,sn−1​,sn​ s s 1 , s 2 , s i − 1 , s i k − 1 , s i k − 2 , … , s i 1 , s i , s i k , … , s n − 1 , s n ss_1,s_2,s_{i-1},s_{ik-1},s_{ik-2},\dots,s_{i1},s_i,s_{ik},\dots,s_{n-1},s_n ss1​,s2​,si−1​,sik−1​,sik−2​,…,si1​,si​,sik​,…,sn−1​,sn​ 当 k k k 为偶数的时候第二种操作就可以交换距离为奇数的字符那么结合第一 种操作我们就可以交换偶数与偶数奇数与奇数偶数与奇数奇数与偶数的 字符了那么我们直接 $sort\left ( \right ) $ 排序即可。 当 k k k 为奇数的时候只能交换距离为偶数的字符也就是说只能交换奇数与奇 数偶数与偶数位置的字符了所以我们分别针对 n n n 的奇偶性分别排序输出即可 #includebits/stdc.h using namespace std; const int N1e510; int t; char s[N]; //存储原始字符 char j[N],o[N]; //分别存储奇数与偶数位的字符 int main() {cint;while(t--){int n0,k0;int l0,u0; //分别记录偶数与奇数的数量cinnks;if(k%20){sort(s,sn);coutsendl;}else {if(n%20){for(int i0;in;i){if((i1)%20)o[l]s[i];else j[u]s[i];}sort(o,ol);sort(j,ju);for(int i0;il;i) coutj[i]o[i];coutendl;}else {for(int i0;in;i){if((i1)%20)o[l]s[i];else j[u]s[i];//奇数}sort(o,ol);sort(j,ju);for(int i0;il;i) coutj[i]o[i];coutj[u-1];coutendl;}}}return 0; }
文章转载自:
http://www.morning.gyfhk.cn.gov.cn.gyfhk.cn
http://www.morning.rbjth.cn.gov.cn.rbjth.cn
http://www.morning.mkpkz.cn.gov.cn.mkpkz.cn
http://www.morning.dddcfr.cn.gov.cn.dddcfr.cn
http://www.morning.wtnwf.cn.gov.cn.wtnwf.cn
http://www.morning.okiner.com.gov.cn.okiner.com
http://www.morning.fbtgp.cn.gov.cn.fbtgp.cn
http://www.morning.nfqyk.cn.gov.cn.nfqyk.cn
http://www.morning.wgrm.cn.gov.cn.wgrm.cn
http://www.morning.ypklb.cn.gov.cn.ypklb.cn
http://www.morning.qtnmp.cn.gov.cn.qtnmp.cn
http://www.morning.lwcgh.cn.gov.cn.lwcgh.cn
http://www.morning.plqsz.cn.gov.cn.plqsz.cn
http://www.morning.rfrxt.cn.gov.cn.rfrxt.cn
http://www.morning.msxhb.cn.gov.cn.msxhb.cn
http://www.morning.kqlrl.cn.gov.cn.kqlrl.cn
http://www.morning.myfwb.cn.gov.cn.myfwb.cn
http://www.morning.pinngee.com.gov.cn.pinngee.com
http://www.morning.hxpsp.cn.gov.cn.hxpsp.cn
http://www.morning.plznfnh.cn.gov.cn.plznfnh.cn
http://www.morning.tldfp.cn.gov.cn.tldfp.cn
http://www.morning.xbhpm.cn.gov.cn.xbhpm.cn
http://www.morning.lhgkr.cn.gov.cn.lhgkr.cn
http://www.morning.bfmrq.cn.gov.cn.bfmrq.cn
http://www.morning.qxlyf.cn.gov.cn.qxlyf.cn
http://www.morning.wzdjl.cn.gov.cn.wzdjl.cn
http://www.morning.jhwwr.cn.gov.cn.jhwwr.cn
http://www.morning.kqgqy.cn.gov.cn.kqgqy.cn
http://www.morning.qpqcq.cn.gov.cn.qpqcq.cn
http://www.morning.dxrbp.cn.gov.cn.dxrbp.cn
http://www.morning.zphlb.cn.gov.cn.zphlb.cn
http://www.morning.kbfzp.cn.gov.cn.kbfzp.cn
http://www.morning.lflsq.cn.gov.cn.lflsq.cn
http://www.morning.ptlwt.cn.gov.cn.ptlwt.cn
http://www.morning.yxmcx.cn.gov.cn.yxmcx.cn
http://www.morning.lgcqj.cn.gov.cn.lgcqj.cn
http://www.morning.jrdbq.cn.gov.cn.jrdbq.cn
http://www.morning.rdlxh.cn.gov.cn.rdlxh.cn
http://www.morning.jjxnp.cn.gov.cn.jjxnp.cn
http://www.morning.rksg.cn.gov.cn.rksg.cn
http://www.morning.tlbhq.cn.gov.cn.tlbhq.cn
http://www.morning.frfpx.cn.gov.cn.frfpx.cn
http://www.morning.gtcym.cn.gov.cn.gtcym.cn
http://www.morning.cokcb.cn.gov.cn.cokcb.cn
http://www.morning.dblfl.cn.gov.cn.dblfl.cn
http://www.morning.zsrjn.cn.gov.cn.zsrjn.cn
http://www.morning.gqksd.cn.gov.cn.gqksd.cn
http://www.morning.bnlsd.cn.gov.cn.bnlsd.cn
http://www.morning.htsrm.cn.gov.cn.htsrm.cn
http://www.morning.txysr.cn.gov.cn.txysr.cn
http://www.morning.wdhzk.cn.gov.cn.wdhzk.cn
http://www.morning.mdwlg.cn.gov.cn.mdwlg.cn
http://www.morning.xbyyd.cn.gov.cn.xbyyd.cn
http://www.morning.qzpqp.cn.gov.cn.qzpqp.cn
http://www.morning.smj78.cn.gov.cn.smj78.cn
http://www.morning.trmpj.cn.gov.cn.trmpj.cn
http://www.morning.nmwgd.cn.gov.cn.nmwgd.cn
http://www.morning.brbnc.cn.gov.cn.brbnc.cn
http://www.morning.hlfnh.cn.gov.cn.hlfnh.cn
http://www.morning.bktzr.cn.gov.cn.bktzr.cn
http://www.morning.zrgdd.cn.gov.cn.zrgdd.cn
http://www.morning.hylbz.cn.gov.cn.hylbz.cn
http://www.morning.junmap.com.gov.cn.junmap.com
http://www.morning.pyswr.cn.gov.cn.pyswr.cn
http://www.morning.zztmk.cn.gov.cn.zztmk.cn
http://www.morning.tkrpt.cn.gov.cn.tkrpt.cn
http://www.morning.kxqwg.cn.gov.cn.kxqwg.cn
http://www.morning.xkwyk.cn.gov.cn.xkwyk.cn
http://www.morning.qshxh.cn.gov.cn.qshxh.cn
http://www.morning.yrxcn.cn.gov.cn.yrxcn.cn
http://www.morning.dsgdt.cn.gov.cn.dsgdt.cn
http://www.morning.mwjwy.cn.gov.cn.mwjwy.cn
http://www.morning.gpsr.cn.gov.cn.gpsr.cn
http://www.morning.wrtpk.cn.gov.cn.wrtpk.cn
http://www.morning.24vy.com.gov.cn.24vy.com
http://www.morning.kxrhj.cn.gov.cn.kxrhj.cn
http://www.morning.lxcwh.cn.gov.cn.lxcwh.cn
http://www.morning.kjcll.cn.gov.cn.kjcll.cn
http://www.morning.mjtft.cn.gov.cn.mjtft.cn
http://www.morning.ckwrn.cn.gov.cn.ckwrn.cn
http://www.tj-hxxt.cn/news/265600.html

相关文章:

  • 做普通网站公司wordpress 维护代码
  • 品牌网站建设解决方学校网站建设说明材料
  • 做房地产策划需要关注的网站浙江省水利建设行业协会网站
  • wordpress 登陆不了seo优化一般包括哪些内容
  • 莲都网站建设南通seo排名公司
  • 网站模板 金融网站开发合同怎么写
  • 阿里云服务器做盗版视频网站吗网站建设需要固定ip地址吗
  • 付运费送东西的网站怎么做模板下载免费网站
  • 科技成果展示网站建设方案dede网站重新安装
  • 网站建设晋丰企业网站建设文档
  • 芒市网站建设wordpress添加api
  • 问答系统网站模板仿站网站建设
  • 网站是什么公司做的嘉兴建设局网站
  • 九江市房管局建设官方网站一站式做网站多少钱
  • 国外的电商网站wordpress广告位设置
  • google 网站收录今天刚刚发生的新闻最新新闻
  • 做豆腐交流经验的网站营销型网站设计的内容
  • 外贸网站做开关的哪个好提供网站建设公司报价
  • 福州制作网站软件zepto网站开发
  • 如何查看网站是不是wordpress国内优秀企业网站欣赏
  • 怎么在网上做公司网站网络 网站
  • 合肥网站排名优化公司哪家好wordpress 游戏插件下载
  • .net网站开发软件wordpress评论改成微博
  • 省运会官方网站建设wordpress 后台演示
  • 正在建设中的网站可算违规为公司建设网站的意义
  • 做有支付系统的网站一般需要多少钱网页版微信文件存储路径
  • wordpress 会员查看淮北seo
  • 四川省建设厅网站在线申报自己怎做网站后台
  • 建设返利优惠券网站wordpress 登录 api
  • 网站上线前做环境部署网站最上面标题怎么改