POJ 1777】的更多相关文章

题目大意: 给定数列 a1 , a2 , ... , an 希望找到一个  N = sigma(ai^ki)  , (0<=ki<10) ,ki可随自己定为什么 只要保证N的因子和可以表示为 2^t的形式 , 输出t , 找不到就输出 NO 关于梅森素数,有一个重要的定理:“一个数能够写成几个不重复的梅森素数的乘积” 等价于 “这个数的约数和是2的幂次”,但是不能重复,比如说3是梅森素数,9就不满足约数和为2的幂. 还有一个重要内容就是,N的约数和幂次是可以直接由构成它的梅森素数的来源幂次相加…
一道好题. 由算术基本定理,知: 那么,对于上式的每个因子值只能是2^M的形式.取第一个式子为例,通过分解因式出(1+p^2)=2^k知,a只能为1. 于是对于p只能是梅森素数.而且每个梅森素数只能出现一次,利用这个就可以求解了, #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int Max=1&…
The Windy's Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 4158   Accepted: 1777 Description The Windy's is a world famous toy factory that owns M top-class workshop to make toys. This year the manager receivesN orders for toys. The man…
题目地址:http://poj.org/problem?id=3006 刷了好多水题,来找回状态...... Dirichlet's Theorem on Arithmetic Progressions Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16803   Accepted: 8474 Description If a and d are relatively prime positive integers, t…
质数(prime number)又称素数,有无限个.一个大于1的自然数,除了1和它本身外,不能被其他自然数整除,换句话说就是该数除了1和它本身以外不再有其他的因数:否则称为合数.      最小的质数是2. [例1]Goldbach's Conjecture (POJ 2262) Description In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in w…
http://poj.org/problem?id=3090 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1777 题目大意: 给你一个坐标系和一个范围,求x.y在[0,N]这个范围内,未被挡住点的个数. 被挡住的点定义为:从原点引一条射线到某个点,若之前经过其他的点,则被挡住. 思路: 未被挡住的一定是互质的(由斜率可以想到) 然后直接打表吧. #include<cstdio> const int MAXN=1002;…
Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798   Special Judge Description Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the…