题面 原题链接(CF1627D) You have an array \(a_1,a_2,-,a_n\) consisting of \(n\) distinct integers. You are allowed to perform the following operation on it: Choose two elements from the array \(a_i\) and \(a_j\) \((i≠j)\) such that \(gcd(a_i,a_j)\) is not p…
1257: [CQOI2007]余数之和sum Time Limit: 5 Sec Memory Limit: 162 MBSubmit: 1779 Solved: 823[Submit][Status] Description 给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值,其中k mod i表示k除以i的余数.例如j(5, 3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3…
Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers. For example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 = 20 + 31, 17 = 23 + 32 = 24 + 30) and…
题目大意:如果一个数t=x^a+y^b(a,b都是大于等于0的整数)那就是一个unlucky数字.给你x,y,l,r(2 ≤ x, y ≤ 10^18, 1 ≤ l ≤ r ≤ 10^18),求出l到r内没有unlucky数字的最小区间. 解题思路:可以知道a,b最多也不会超过60(2^60>1e18),所以可以直接枚举x^a+y^b的值存到vector里,然后排序,遍历一下vector,找出v[i+1]-v[i]-1(因为两端都是unlucky数字所以要两个端点都不算在长度内)最大的区间即可.…