A. Secrets Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/333/problem/A Description Gerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has…
题目链接:http://codeforces.com/problemset/problem/334/C 题目: 题目大意: 给定数字n,要求构建一个数列使得数列的每一个元素的值都是3的次方,数列之和S大于n,且删掉数列中的任意一个元素数列之和都会小于n,最大化这个数列的长度 题解: 我们考虑从小到大枚举k,取最小的k,使得,答案就是$n/3^k+1$ 为什么呢? 我们考虑一个合法的数列,其中最小的元素是A,那么S一定是A的倍数.假设n是A的倍数,又S>n,那么S-A>=n,这样的话去掉A这个数…
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the…
数学so奇妙.. 这题肯定会有一个循环节 就是最小公倍数 对于公倍数内的相同的数的判断 就要借助最大公约数了 想想可以想明白 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> using namespace std; #define N 1000100 #defin…
C. Fly time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on n−2n−2 intermediate planet…
B. Chips Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/333/problem/B Description Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to…
A. Secrets http://www.cnblogs.com/qscqesze/p/4528529.html B. Chips http://www.cnblogs.com/qscqesze/p/4528579.html…
http://codeforces.com/contest/334 A题意:1-n^2 平均分成 n 份,每份n个数,且和相同 解法 : 构造矩阵1-n^2的矩阵即可 ][]; int main() { int n; scanf("%d",&n); int k = n*n; ; ; i < n ; i++) ; j < n ; j++) a[i][j] = c++;} ; i < n ; i++) { ; j < n ; j++) printf(&quo…
A. Candy Bags 总糖果数\(\frac{n^2(n^2+1)}{2}\),所以每人的数量为\(\frac{n}{2}(n^2+1)\) \(n\)是偶数. B. Eight Point Sets 模拟. C. Secrets 将\(n\)转成3进制数,考虑最后一位非0位,没有刚好\(n\)的数量为非0位的前一位加1,当前位置0,最后将钱都转化为最低单位. D. Chips 在没有障碍的情况下,有冲突的列.行,我们可以找到一个排列解决冲突. 除了\(n\)是奇数时的中心点无法解决冲突.…
D. Chips time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he…