随笔分类 - 基础----模拟
摘要:xg 题意 给相同长度为n的两个数组a,b。其中包括1-n和n个0。 一次操作:可以把a中任意一个数放到b的最右面,然后把b的最前面一个数放到a中。 问最少多少次操作可以使得b数组为1,2,3.....n。 思路 很明显a数组不影响结果,只需要分析b数组即可。且最多只需要2*n次操作。 如果1-n都
阅读全文
摘要:xg 太久没写模拟,总是写一般觉得纰漏太多 #include <iostream> #include <cmath> #include <cstdio> #include <cstring> #include <string> #include <map> #include <iomanip> #i
阅读全文
摘要:xg 题意 给你n个数,和H,第pos次,sumpos大于H(sum为前缀和)。求最小的pos,pos属于1到+无穷。输出最小的pos,无解输出-1。 思路 对于1-n。如果sum>=H,则直接输出。 对于大于n。如果sum.n小于H,则无解。 否则,则答案一定为 i+k*n(i为【1,n】,k为【
阅读全文
摘要:can 题意:t个样例。给长度为n的数组a和k,n为偶数。a数组每个值都小于k。你可以改变数组的任意一个数到范围【1,k】,使得数组a满足对任意i,a[i]+a[n-i+1]相等。输出改变数组中的数的最小个数。 思路:n和k一共不超过2e5。如果一对数都更改,则范围都为【2,2*k】。如果一对数(x
阅读全文
摘要:D - Various Sushi Time Limit: 2 sec / Memory Limit: 1024 MB Score : 400400 points Problem Statement There are NN pieces of sushi. Each piece has two p
阅读全文
摘要:C. Covered Points Count time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output C. Covered Point
阅读全文
摘要:C. Permute Digits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given two posit
阅读全文
摘要:C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. Cinema time limit per test
阅读全文