Problem Description Alice and Bob want to play an interesting game on a tree.Given is a tree on N vertices, The vertices are numbered from 1 to N. vertex 1 represents the root. There are N-1 edges. Players alternate in making moves, Alice moves first. A move consists of two steps. In the firs
Problem Description XOR is a kind of bit operator, we define that as follow: for two binary base number A and B, let C=A XOR B, then for each bit of C, we can get its value by check the digit of corresponding position in A and B. And for each digit, 1 XOR 1 = 0, 1 XOR 0 = 1, 0 XOR 1 = 1, 0 XOR
Problem Description Alice has received a beautiful present from Bob. The present contains n lanterns and m switches. Each switch controls some lanterns and pushing the switch will change the state of all lanterns it controls from off to on or from on to off. A lantern may be controlled by many switc
? 原创 ?
2018-03-13 13:39:01
301
0
0
PDF以及配套数据下载地址:难题选讲2-送你一公式数论-Rockdu.rar
引言:有一类数论问题,考察数学公式的灵活运用与变换。我们来看一个例子:
最小公倍数之和 V3
时空限制:1s / 256MB
出一个数N,输出小于等于N的所有数,两两之间的最小公倍数之和。
相当于计算这段程序(程序中的lcm(i,j)表示i与j的最小公倍数):
由于结果很大,输出Mod 1000000007的结果。
G=0;for(i=1;i< N;i++)for(j=1;j<=N;j++){ G = (G + lcm(i,j)) % 1000000007;}
Description
明明这次又要出去旅游了,和上次不同的是,他这次要去宇宙探险!我们暂且不讨论他有多么NC,他又幻想了他应
该带一些什么东西。理所当然的,你当然要帮他计算携带N件物品的方案数。他这次又准备带一些受欢迎的食物,
如:蜜桃多啦,鸡块啦,承德汉堡等等当然,他又有一些稀奇古怪的限制:每种食物的限制如下:
承德汉堡:偶数个
可乐:0个或1个
鸡腿:0个,1个或2个
蜜桃多:奇数个
鸡块:4的倍数个
包子:0个,1个,2个或3个
土豆片炒肉:不超过一个。
面包:3的倍数个
注意,这里我们懒得考虑明明对于带的食物该怎么搭配着吃,也认为每种食物都是以‘个’为单位(反
Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this: N=a[1]+a[2]+a[3]+...+a[m]; a[i]>0,1<=m<=N;My question i
Problem DescriptionPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available in Silverland
Alice and Bob begin their day with a quick game. They first choose a starting number X0 ≥ 3 and try to reach one million by the process described below.
Alice goes first and then they take alternating turns. In the i-th turn, the player whose turn it is selects a prime number smaller than the curr
题目描述
给出n个数qi,给出Fj的定义如下:
Fj=∑i<jqiqj(i−j)2−∑i>jqiqj(i−j)2" role="presentation" style="position: relative;">Fj=∑i<jqiqj(i−j)2−∑i>jqiqj(i−j)2Fj=∑i<jqiqj(i−j)2−∑i>jqiqj(i−j)2 F_j = \sum_{ij}\frac{q_i q_j}{(i-j)^2
题目描述
设d(x)为x的约数个数,给定N、M,求 ∑i=1N∑j=1Md(ij)" role="presentation" style="position: relative;">∑Ni=1∑Mj=1d(ij)∑i=1N∑j=1Md(ij)\sum^N_{i=1}\sum^M_{j=1}d(ij)
输入输出格式
输入格式:
输入文件包含多组测试数据。第一行,一个整数T,表示测试数据的组数。接下来的T行,每行两个整数N、M。
输出格式:
T行,每行一个整数,表示你所求的答案。
输入输出样例
输入样例#1: 复制
2