摘要:4491. Primes in GCD TableProblem code: PGCDJohnny has created a table which encodes the results of some operation -- a function of two arguments. But instead of a boring multiplication table of the sort you learn by heart at prep-school, he has created a GCD (greatest common divisor) table! So he no
阅读全文
摘要:7001. Visible Lattice PointsProblem code: VLATTICEConsider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are visible from corner at (0,0,0) ? A point X is visible from point Y iff no other lattice point lies on the segment joining X and Y.Input
阅读全文
摘要:2301: [HAOI2011]Problem bTime Limit:50 SecMemory Limit:256 MBSubmit:436Solved:187[Submit][Status]Description对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数。Input第一行一个整数n,接下来n行每行五个整数,分别表示a、b、c、d、kOutput共n行,每行一个整数表示满足要求的数对(x,y)的个数Sample Input22 5 1 5 11 5 1 5 2 Sample Output1
阅读全文
摘要:GCDTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4291Accepted Submission(s): 1502Problem DescriptionGiven 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x an
阅读全文