E. Ehab's REAL Number Theory Problem 数论+图论 求最小环 题目大意: 给你一个n大小的数列,数列里的每一个元素满足以下要求: 数据范围是:\(1<=a_i<=10^6\) \(a_i\) 最多只有7个因数 题目要求在这个数列找到一个最短的子数列,子数列的所有的数相乘是一个完全平方数. 题解: 这个题对于 \(x^{3}\) 应该等价于 \(x\) ,其实就是可以除去 \(a_i\)中的所有的平方项,显而易见,这个并不影响答案. 因为 \(a_i\) 最多只…
X problem X问题 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4358 Accepted Submission(s): 1399 Problem Description 求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod…
题意: 给出n, k,求 分析: 假设,则k mod (i+1) = k - (i+1)*p = k - i*p - p = k mod i - p 则对于某个区间,i∈[l, r],k/i的整数部分p相同,则其余数成等差数列,公差为-p 然后我想到了做莫比乌斯反演时候有个分块加速,在区间[i, n / (n / i)],n/i的整数部分相同,于是有了这份代码. #include <cstdio> #include <algorithm> using namespace std;…
11490 - Just Another Problem option=com_onlinejudge&Itemid=8&page=show_problem&category=474&problem=2485&mosmsg=Submission+received+with+ID+13809788" target="_blank" style="">题目链接 题意:有S个士兵.排成一个矩阵,矩阵中能够有两个洞,要…
n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n…
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4109 题意: 输入正整数n和k(1≤n,k≤1e9),计算sum(k mod i)(1≤i≤n). 分析: 被除数固定,除数逐次加1,直观上余数也应该有规律.假设k/i的整数部分等于d,则k mod i = k-i*d.因为k/(i+1)和k/i差别不大,如果k/(i+1)的整数部…
题目链接:http://codeforces.com/problemset/problem/798/C 题意:给你n个数,a1,a2,....an.要使得gcd(a1,a2,....an)>1,可以执行一次操作使ai,ai+1变为ai - ai + 1, ai + ai + 1.求出使得gcd(a1,a2,....an)>1所需要的最小操作数. 解题思路:首先,要知道如果能够实现gcd(a1,a2,....an)>1,那么a1~an肯定都是偶数(0也是偶数),所以我们的目的就是用最少的操…
Factorial Problem in Base K Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3621 Description How many zeros are there in the end of s! if both s and s! are written in base k which is not nece…
987654321 problem Problem's Link Mean: 略 analyse: 这道题目是道简单题. 不过的确要好好想一下: 通过简单的搜索可以知道,在N<9时答案一定为0,而N=9时有8个解.由于题目只是问“最后9位”,所以N=10的时侯第10位的取值不会对平方和的“最后9位”产生影响,而第10位上有9种取值方法,所以N=10的时侯,答案是72. 同样可以知道,当N>10的时侯,只要在72后加入(N-10)个“0”即可. Time complexity: O(n) vie…
B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks f…
A Trivial Problem Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number of positive integers n, such that the factorial of n ends with exactly m zeroes. Are you among thos…
Description Have you heard the fact "The base of every normal number system is 10" ? Of course, I am not talking about number systems like Stern Brockot Number System. This problem has nothing to do with this fact but may have some similarity. Y…
给大一的排位赛中数论的一题.好吧不会做...提供一个题解吧:http://blog.csdn.net/aozil_yang/article/details/53538854. 又学了一个新的公式..如果x和y互质,那么x+y和x*y互质.证明如下:随便找一个x中有的因子c,因为x,y互质,因此c不是y的因子.同时c是x*y的因子,由同余模方程知(x+y)% c = x % c + y % c = 0 + y % c.因为c不是y的因子,所以不等于0,所以c不是x+y的因子.同理可以证得x和y中的…
Problem Description When Teddy was a child , he was always thinking about some simple math problems ,such as "What it's 1 cup of water plus 1 pile of dough .." , "100 yuan buy 100 pig" .etc.. One day Teddy met a old man in his dream ,…
A New Change Problem Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can assume that there are enough coins for both kinds.Please calculate the maximal value that you cannot pay and the total number tha…
Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can assume that there are enough coins for both kinds.Please calculate the maximal value that you cannot pay and the total number that you cannot pay. Inp…