CF: Long Number】的更多相关文章

http://codeforces.com/contest/382/problem/B 题意:给你Aa,b,w,x,c,然后每经过1秒,c=c-1;  如果b>=x,b=b-x;否则 a=a-1,b=w-(x-b);  问经过多少秒c<=a; #include <cstdio> #include <cstring> #include <algorithm> #define ll __int64 using namespace std; ll a,b,w,x,…
传送门 可以理解为上一道题的扩展板.. 然后我们就可以YY出这样一个式子 ${\sum_{i=1}^a\sum_{j=1}^b\sum_{k=1}^cd(ijk)=\sum_{i=1}^a\sum_{j=1}^b\sum_{k=1}^c[gcd(i,j)=gcd(i,k)=gcd(j,k)=1]\lfloor\frac{a}{i}\rfloor\lfloor\frac{b}{j}\rfloor\lfloor\frac{c}{k}\rfloor}$ 然后我们枚举第一维,排除掉不和第一维互质的数大力…
                                                题目链接 #include<iostream> #include<string> using namespace std; int main() { int n; cin >> n; string a; cin >> a; int f[10]; for(int i = 1; i <= 9; i++) cin >> f[i]; for(int i…
挺水的一道题~ 拿全排列随便乘一下就好了. #include <cstdio> #include <algorithm> #define N 300004 #define ll long long #define mod 998244353 #define setIO(s) freopen(s".in","r",stdin) using namespace std; struct Node { int a,b; }t[N]; ll fac[N…
github传送门 项目相关要求 使用 -n 参数控制生成题目的个数.(实现) 使用 -r 参数控制题目中数值(自然数.真分数和真分数分母)的范围.(实现) 生成的题目中计算过程不能产生负数.(实现) 生成的题目中如果存在形如e1 ÷ e2的子表达式,那么其结果应是真分数.(实现) 每道题目中出现的运算符个数不超过3个.(实现) 程序一次运行生成的题目不能重复.(实现) 在生成题目的同时,计算出所有题目的答案,并存入执行程序的当前目录下的Answers.txt文件.(实现) 程序应能支持一万道题…
B. Lost Number[CF交互题 暴力] This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to…
CF - 392 C. Yet Another Number Sequence 题目传送门 这个题看了十几分钟直接看题解了,然后恍然大悟,发现纸笔难于描述于是乎用Tex把初始矩阵以及转移矩阵都敲了出来 \(n\le 1e17\) 这个数量级求前缀和,发现递推关系之后矩阵快速幂是可以求出来的,所以就尝试把\(A_i(k)\) 的递推式求出来. \[A_{i-1}(k) = F_{i-1} * (i-1) ^ k\\ A_{i-2}(k) = F_{i-2} * (i-2) ^ k \] \[\be…
Let's call a number k-good if it contains all digits not exceeding k (0, ..., k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a). Input The firs…
CF 441E Description 一共执行\(k\)次,每次有\(p\%\)把\(x * 2\),有\((100 - p)\%\)把\(x + 1\).问二进制下\(x\)末尾期望\(0\)的个数. Solution 设\(f[i][j]\)为执行第\(i\)次后\(x + j\)末尾期望\(0\)的个数 加一:$f[i + 1][j - 1] = f[i + 1][j - 1] + (100 - p)% * f[i][j]; $ 乘二:\(f[i + 1][j * 2] = f[i +…
G. Xor-matic Number of the Graph 链接 题意: 给定一个无向图,一个interesting的三元环(u,v,s)满足,从u到v的路径上的异或和等于s,三元环的权值为s,求所有三元环权值之和. 分析: 求出所有的三元环,建立线性基,然后逐位求每一位的贡献. 代码: #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #include&…
题意:给你n个数,然后把这个n个数的乘积化成n个数相乘,可以化成多少个. 思路:分解质因数,求出每一个质因子的个数,然后用组合数学中隔板法把这些质因子分成n分,答案就是所有质因子划分成n份的情况的乘积. #include <cstdio> #include <cstring> #include <map> #include <algorithm> #define maxn 100100 #define ll long long using namespace…
题意:给你两个数p和x,然后让你找出一个长度为p的数,把它的最后移到最前面之后得到的数是原来数字的x倍,有很多这样的数取最小. 思路:枚举最后一位,然后就可以推出整个的一个数,然后比较得到的数的第一个数字和枚举的数字是否相等既可以. #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int p,x; ]; int ma…
http://codeforces.com/problemset/problem/387/C 题意:给你一个大数,让你求个集合,可以通过操作得到这个数,求集合中个数最大值,操作 :从集合中任意取两个数,大的数放在前面小的数放在后面组成一个数在重新放入集合中,经过重复的操作,集合中只剩一个数,这个数就是给你的数. 思路:要求个数最大,可以让这个大数的每一个数字为集合中的一个数,但是集合中不能有0,所以在连续的0前面要连着一个非零的数. #include <cstdio> #include <…
http://codeforces.com/contest/359/problem/C 先求出分子的公因子,然后根据分子上会除以公因子会长生1,然后记录1的个数就可以. #include <cstdio> #include <cstring> #include <algorithm> #define maxn 200000 #define LL __int64 using namespace std; LL a[maxn]; LL n,x; LL min1(LL s,L…
[题目描述] Bike是一位机智的少年,非常喜欢数学.他受到142857的启发,发明了一种叫做“循环数”的数. 如你所见,142857是一个神奇的数字,因为它的所有循环排列能由它乘以1,2,...,6(1到它的长度)得到.循环排列意味着将该数的一些数位从尾部挪到前面.例如,12345的循环排列包括:12345,51234,45123,34512,23451.值得一提的是,允许出现前导零.因此4500123和0123450都是0012345的循环排列.你可以看到142857满足条件的原因.以下六个…
题意:给一棵树,点$i$的点权是$2^i$,你需要删掉$k$个点,使得剩下的点连通的情况下剩下的点权值和最大. $k \leq n \leq 10^6$ 如果考虑删哪些点,是不好考虑的,会出问题. 反过来考虑,要保留哪些点,这样我们才可以保证让保留的点权值和最大. 我们以$n$这个点为根,然后从$n$到$1$依次考虑这个点可不可以保留,能保留就保留. 一个点能保留的条件是:因为它要保留,而需要保留的所有点的个数+现在已确定保留的点的个数$\leq n-k$ 哪些是“因为它要保留,而需要保留的点”…
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", &q…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Piegirl got bored with binary, decimal and other integer based counting systems. Recently she dis…
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Piegirl was asked to implement two table join operation for distributed database system, minim…
题目: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae"…
E. Sign on Fence time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bizon the Champion has recently finished painting his wood fence. The fence consists of a sequence of n panels of 1 meter w…
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input: Digit string "23" Output: ["ad", "ae", &…
问题: Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Example:Input:Digit string "23"Output: ["ad", "ae&…
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", &q…
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", &q…
Freelancer's Dreams time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool p…
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Notice Although the above answer is in lexicographical order, your answe…
Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Outpu…
1 题目: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae&quo…