因为所有整数都能被唯一分解,p1^a1*p2^a2*...*pi^ai,而一次询问的数可以分解为p1^a1k*p2^a2k*...*pi^aik,这次询问会把所有a1>=a1k && a2 >= a2k &&...a3 >= a3k的数从原来的集合中分开。ai表示pi的幂。那么只有当这个数的素因子的...
分类:
其他好文 时间:
2015-09-11 06:39:51
阅读次数:
145
模拟题,map搞一搞。用了点c11的特性。#includeusing namespace std;typedef map Node;map::iterator it_id;const int maxnd = 1e4;Node nds[maxnd];int nds_cnt;#define MP mak...
分类:
其他好文 时间:
2015-09-05 23:34:04
阅读次数:
196
1922. [CF 121E]幸运数列★★★ 输入文件:cf121e.in 输出文件:cf121e.out 简单对比
时间限制:3 s 内存限制:256 MB
【题目描述】对于欧洲人来说,“幸运数”是指那些十进制只由4或7组成的数。财务员Petya需要维护一个支持如下操作的整数数列:
add l r d — 表示将[l, r]区间内的所有数加上一个正整数d()。...
分类:
编程语言 时间:
2015-07-25 21:37:52
阅读次数:
284
B. A Lot of JoyTime Limit: 20 SecMemory Limit: 256 MB题目连接http://codeforces.com/gym/100187/problem/ADescriptionTwo boys Gena and Petya wrote on two str...
分类:
其他好文 时间:
2015-07-18 21:17:51
阅读次数:
206
给定n,要求给出n个数,是的任意两数不互质,但所有数的最大公约数为1
很简单,所有数的最大公约数为1只需三个数最大公约数为1,假设a,b,c为素数,设第一个数为ab,第二个数为ac,第三个数为bc,则这三个数最大公约数已经为1,那么剩下的数只要满足与他们不互质即可,不妨令以后的数为 bc*i(i>1),则问题已解。
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2015-05-18 09:14:04
阅读次数:
93
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX.
Now Petya is wondering in how many ways he can choose three distinct points so that the distance be...
分类:
其他好文 时间:
2015-05-16 16:33:10
阅读次数:
138
D - Coloring Brackets
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice CodeForces
149D
Description
Once Petya read a problem about...
分类:
其他好文 时间:
2015-05-02 09:43:12
阅读次数:
220
Description 有一天Petya和他的朋友Vasya在进行他们众多旅行中的一次旅行,他们决定去参观一座城堡博物馆。这座博物馆有着特别的样式。它包含由m条走廊连接的n间房间,并且满足可以从任何一间房间到任何一间别的房间。两个人在博物馆里逛了一会儿后两人决定分头行动,去看各自感兴趣的艺术品。他....
分类:
其他好文 时间:
2015-04-01 00:14:38
阅读次数:
345
Description描述Inspired by a "Little Bishops" problem, Petya now wants to solve problem for rooks.A rook is a piece used in the game of chess which is p...
分类:
其他好文 时间:
2015-03-07 15:37:14
阅读次数:
101
1581. Teamwork
Time limit: 1.0 second
Memory limit: 64 MB
Vasya and Petya are going to participate in a team olympiad in informatics. They have listened to the stories told by the gurus o...
分类:
其他好文 时间:
2015-03-07 14:16:40
阅读次数:
129