题目链接:https://codeforces.com/contest/670/problem/F 题意: 有一个非负整数 $n$,在它的右侧添上它的位数后,被发送出去:例如 $6510$,加上位数 $4$,变成 $65104$,发送出去. 但是,接受者接收到的数字则是被打乱了的,例如接收到了 $01465$,发送者只知道其中一段数字是什么,例如知道原数字中有一段是 $51$. 要你根据已知的信息推测出可能的 $n$ 中最小的那个. 题解: 首先在大约 $O(n)$ 的时间复杂度下可以知道这个数…
模拟. 首先暴力找到答案的位数,然后就是分类讨论输出答案. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k - the num…
F. Restore a Number   Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order whil…
题目描述: time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Dima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the strip turned…
[Codeforces 1208D]Restore Permutation (树状数组) 题面 有一个长度为n的排列a.对于每个元素i,\(s_i\)表示\(\sum_{j=1,a_j<a_i}^i a_j\).即前面比它小的元素的值之和. 给出\(s_1,s_2 \dots s_n\),求a 分析 考虑如何求\(a_n\),\(s_n\)实际上表示的是1~n中比\(a_n\)小的所有数的和,可以直接求出\(a_n\) 然后我们可以倒序求\(a_i\),求到\(a_i\)的时候,我们已经知道\(…
B. Split a Number time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Dima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the stri…
A. Cutting Banner time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami…
Queries for Number of Palindromes Problem's Link:   http://codeforces.com/problemset/problem/245/H Mean: 给你一个字符串,然后q个询问:从i到j这段字符串中存在多少个回文串. analyse: dp[i][j]表示i~j这段的回文串数. 首先判断i~j是否为回文,是则dp[i][j]=1,否则dp[i][j]=0; 那么dp[i][j]=dp[i][j]+dp[i][j-1]+dp[i+1[j…
[题目链接]:http://codeforces.com/contest/805/problem/D [题意] 给你一个字符串; 里面只包括a和b; 让你把里面的"ab"子串全都去掉; 方式是, 每次操作可以把"ab"替换成为"bba"; 直到整个字符串里面没有"ab"子串为止 [题解] 从ab开始 ab->bba 左边再加一个a的话 即aab 就相当于在bba左边加了一个a abba -> bbaba bbbba…