URAL 1355. Bald Spot Revisited(数论)】的更多相关文章

1355. Bald Spot Revisited Time limit: 1.0 secondMemory limit: 64 MB A student dreamt that he walked along the town where there were lots of pubs. He drank a mug of ale in each pub. All the pubs were numbered with positive integers and one could pass…
题目链接 题意 : 一个学生梦到自己在一条有很多酒吧的街上散步.他可以在每个酒吧喝一杯酒.所有的酒吧有一个正整数编号,这个人可以从n号酒吧走到编号能整除n的酒吧.现在他要从a号酒吧走到b号,请问最多能喝到多少酒. 思路 :因为b肯定要是a的倍数,是a从头开始乘下去的,实际上就是找构成b/a的素数划分,有多少个素数划分就可以喝到多少的酒. #include <stdio.h> #include <string.h> #include <iostream> using na…
1355 其实就是求质因子的个数 这样肯定是最多的 注意一下 除到最后不是1的情况 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<cmath> using namespace std; #define N 32000 int p[N],g,f[N]; void init() {…
The blocks in the city of Fishburg are of square form. N avenues running south to north and Mstreets running east to west bound them. A helicopter took off in the most southwestern crossroads and flew along the straight line to the most northeastern…
Black Spot Time limit: 1.0 secondMemory limit: 64 MB Bootstrap: Jones's terrible leviathan will find you and drag the Pearl back to the depths and you along with it. Jack: Any idea when Jones might release said terrible beastie? Bootstrap: I already…
右侧是1.维护的同时保持最短路p值至少,我有直接存款(1-p).该概率不满足,为了使这个值极大. #include <iostream> #include <cstdlib> #include <cstring> #include <string> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include…
1356. Something Easier Time limit: 1.0 secondMemory limit: 64 MB “How do physicists define prime numbers? Very easily: prime numbers are the number 2 and all the odd numbers greater than 2. They may show that this definition corresponds to the mathem…
题目链接 题意 : 给你一个数,未知进制,然后让你从2到36进制中找出一个最小的进制K,满足给你的这个数作为k进制时能够整除k-1. 思路 : 有一个公式,(a*b^n)mod(b-1)=a: 给定你这个数,当做字符串输入的时候,这个数转化成10进制的结果应该是:a[0]*k^(n-1)+a[1]*k^(n-2)+……+a[n-1]*k^0,然后题目要求的就是这个式子的结果取余(k-1)为0, 经过最开始给出的公式,将该式子化简得(a[0]+a[1]+……+a[n-1])%(k-1),所以只要满…
1049. Brave Balloonists Time limit: 2.0 secondMemory limit: 64 MB Ten mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately,…
题目链接 题意 :给你a,b,n,让你找出两个数x,y,使得n-(a*x+b*y)最小. 思路 : 分大小做,然后枚举a的倍数 #include <stdio.h> #include <string.h> #include <iostream> #define LL __int64 using namespace std ; int main() { LL a,b,n ; while(~scanf("%I64d %I64d %I64d",&a…