https://codeforces.com/contest/1202/problem/D 当时想的构造是中间两个3,然后前后的1和7组合出n,问题就是n假如是有一个比较大的质数因子或者它本身就是质数就会超长度.事实上程序会正确执行并分解成两个超大质数,不断putchar导致TLE. 正确的做法是通过3来主要组成答案,考虑133..337,中间有x个3,则有C(x,2)个组合,很明显可以发现在x=45000附近超过1e9的上限,而剩下的余数不会超过x=45000(或者在这个附近?). 考虑怎么添…
题目链接: D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For each string s consisting of characters '0' and '1' one can define four integers a00, a01, a10 and a11, where …
http://codeforces.com/problemset/problem/1009/B B. Minimum Ternary String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a ternary string (it is a string which consists only…
Print Description of "string":把 string 的信息输出到控制台.Copy:复制 string 的信息,包含变量名,类名和值.View Value As:以什么类型的格式来查看变量,默认情况下会自动推断类型.Edit Value:可以直接修改变量的值.在 Swift中无法修改Edit Summary Format:修改输出信息的格式,这里的修改会直接影响 Copy 出来的东西.在 Swift 中无效.Add expression:和断点类似,可以输入新的…
C. Bear and String Distance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letter…
C. The Smallest String Concatenation time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You're given a list of n strings a1, a2, ..., an. You'd like to concatenate them together in some order…
题目链接:https://codeforces.com/problemset/problem/1202/D 题意: 构造一串只由 ‘1’,‘3’,‘7’ 组成的字符串,使其 ‘1337’ 子序列数量为n 思路: 构造 ‘13377733337’ 类型的字符串,使 C(m,2)+k=n k为中间 ‘7’ 的数量,C(m,2)为中间 ‘3’ 的数量 #include <bits/stdc++.h> using namespace std; typedef long long ll; #define…
题目链接 给出一个图, 每个节点只有三种情况, a,b, c. a能和a, b连边, b能和a, b, c,连边, c能和b, c连边, 且无重边以及自环.给出初始的连边情况, 判断这个图是否满足条件. 由题意可以推出来b必然和其他的n-1个点都有连边, 所以初始将度数为n-1的点全都编号为b. 然后任选一个与b相连且无编号的点, 编号为1. 然后所有与1无连边的点都是3. 然后O(n^2)检查一下是否合理. #include <iostream> #include <vector>…
B. Recover the String 题目连接: http://www.codeforces.com/contest/708/problem/B Description For each string s consisting of characters '0' and '1' one can define four integers a00, a01, a10 and a11, where axy is the number of subsequences of length 2 of…
H - Football BetsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87493#problem/H Description While traveling to England, it is impossible not to catch the English passion for football. Almost everyon…