Nastya and a Wardrobe time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nastya received a gift on New Year — a magic wardrobe. It is magic because in the end of each month the number of dress…
我是题面 题意很清晰,这种题,我们当然还是有两种方法来做啦 方法一:找规律 读完题我们来看样例,通过样例一已我们大概可以看出,答案或许是\(n*2^{k+1}\) 肯定不能这么简单对吧,那就来看样例二,难道答案是\(n*2^{k+1}-k\)或者是\(n*2^{k+1}-2^{k-1}\)也有可能是\(n*2^{k+1}-2^k+1\) 通过样例三可得,答案是\(n*2^{k+1}-2^k+1\) 方法二:数学证明 每个月都是乘2,所以第i个月取走一个对第j个月的影响就是\(2^{j-i}(i<…
Nastya received a gift on New Year - a magic wardrobe. It is magic because in the end of each month the number of dresses in it doubles (i.e. the number of dresses becomes twice as large as it is in the beginning of the month). Unfortunately, right a…
<题目链接> 题目大意: 你开始有X个裙子 你有K+1次增长机会 前K次会100%的增长一倍 但是增长后有50%的机会会减少一个 给你X,K(0<=X,K<=1e18), 问你最后裙子数量的期望值是多少(答案 mod 1e9+7) 解题分析: 一看到X,K的范围这么大,就应该想到是要推公式,找规律的题.本题的公式很好推,直接按照题意模拟即可. #include <cstdio> #include <cstring> #include <algorith…
写一下二叉树  推一下公式就出来了, 注意取模时的输出形式 #include <bits/stdc++.h> #define mem(a, b) memset(a, b, sizeof(a)) using namespace std; typedef long long LL; , INF = ; LL n, k; LL qp(LL a, LL b) { LL res = ; while(b) { ) res = res * a % MOD; a = a * a % MOD; b >&g…
http://codeforces.com/problemset/problem/992/C 题意: 给你两个数x,k,k代表有k+1个月,x每个月可以增长一倍,增长后的下一个月开始时x有50%几率减1,增长k+1个月后结果是每种情况的总和除以种数. 题目要求的是增长k+1个月后的结果. 我们根据第三个样例可以推出他的增长过程 3 6 5 12 11 10 9 |     |     | | 24    22 20 18 从这个推导我们容易得出最后得到的每种情况构成一个等差数列,公差为2 结果是…
B. Nastya Studies Informatics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so s…
题目地址: 选题为入门的Codeforce div2/div1的C题和D题. 题解: A:CF思维联系–CodeForces -214C (拓扑排序+思维+贪心) B:CF–思维练习-- CodeForces - 215C - Crosses(思维题) C:CF–思维练习–CodeForces - 216C - Hiring Staff (思维+模拟) D:CF思维联系–CodeForces-217C C. Formurosa(这题鸽了) E:CF思维联系–CodeForces - 218C E…
A. Nastya and an Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nastya owns too many arrays now, so she wants to delete the least important of them. However, she discovered that this…
Nastya and an Array 输出有几种不同的数字 #pragma comment(linker, "/STACK:102400000,102400000") #ifndef ONLINE_JUDGE #include "stdafx.h" #else #include<bits/stdc++.h> #endif using namespace std; typedef long long lint; typedef vector<int…