Lightoj-1220】的更多相关文章

http://lightoj.com/volume_showproblem.php?problem=1220 Mysterious Bacteria Time Limit:500MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1220 Description Dr. Mob has just discovered a Deathly Bacteria. He na…
Mysterious Bacteria LightOJ - 1220 https://vjudge.net/problem/LightOJ-1220 "Each case starts with a line containing an integer x. You can assume that x will have magnitude at least 2 and be within the range of a 32 bit signed integer." x至少是2?不,x…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1220 题意:已知 x=bp 中的 x 求最大的 p,其中 x b p 都为整数 x = (p1a1*p2a2*p3a3*...*pkak), pi为素数;则结果就是gcd(a1, a2, a3,...,ak); 当x为负数时,要把ans缩小为奇数; #include <stdio.h> #include <string.h> #include <iostream&…
暴力就行了,找出素因子,正的最多是30,然后负的最多是31(这一点wa了一次) #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include <algorithm> #include <cstring>…
#include<bits/stdc++.h> using namespace std; #define maxn 1000005 #define ll long long int v[maxn],prime[maxn],m; void init(int n){ memset(v,,sizeof v); memset(prime,,sizeof prime); m=; ;i<=n;i++){ ){ v[i]=i; prime[++m]=i; } ;j<=m;j++){ if(pri…
题意: 给出一个数x 求 x = bp  的p的最大值 解析: 算术基本定理 分解质因数 任何一个数x都可以表示为  x == p1a1   *  p2a2  *  ````` * pnan 即  bp  ==  p1a1   *  p2a2  *  ````` * pnan  == (p1b1 * p2b2 * `````` * pnbn)p 所以  pmax  == gcd(a1,a2,·····,an): 如果x是一个负数  则p只能为奇数 先把x换成正数求出最大p之后 如果x 为负 则不…
题目大意: 给出一个x,求满足x = b^p,p最大是多少? 解题思路: x可以表示为:x = p1^e1 * p2^e2 * p3^e3 ....... * pn^en. p = gcd (e1,e2,.......en); x是负数的时候,p的值不能为偶数,这是坑点之一,还有一个是,题目上说只能用lld,我用的I64d,wa了一下午,想死的冲动都有了,直接上代码,我想静静~~~~~ 代码: #include <cstdio> #include <cstring> #includ…
题意: ttt 组数据,第一个给定飞毯的面积为 sss,第二个是毯子的最短的边的长度大于等于这个数,毯子是矩形但不是正方形. 思路: 求出 sss 的所有因子,因为不可能是矩形,所以可以除以 222,最后暴力求出最短边长以内的因子,相减得出答案. 想要求出s以内的因子数量,就用到了唯一分解定理,先求素数想要求出s以内的因子数量,就用到了唯一分解定理,先求素数想要求出s以内的因子数量,就用到了唯一分解定理,先求素数 唯一分解定理: 任何一个大于1的自然数 N,如果N不为质数,那么N可以唯一分解成有…
        ID Origin Title   111 / 423 Problem A LightOJ 1370 Bi-shoe and Phi-shoe   21 / 74 Problem B LightOJ 1356 Prime Independence   61 / 332 Problem C LightOJ 1341 Aladdin and the Flying Carpet   54 / 82 Problem D LightOJ 1336 Sigma Function   66 /…
KUANGBIN带你飞 全专题整理 https://www.cnblogs.com/slzk/articles/7402292.html 专题一 简单搜索 POJ 1321 棋盘问题    //2019.3.18 POJ 2251 Dungeon Master POJ 3278 Catch That Cow  //4.8 POJ 3279 Fliptile POJ 1426 Find The Multiple  //4.8 POJ 3126 Prime Path POJ 3087 Shuffle…