contest

AtCoder Beginner Contest 132 F - Small Products

风格不统一 提交于 2020-01-19 11:34:01
数 sqrt 缩小范围 整除分块 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cmath> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std; 9 #define ll long long 10 11 const int maxn=1e5+10; 12 const ll mod=1e9+7; 13 const double eps=1e-8; 14 15 ll f[110][maxn],add[maxn],cnt[maxn]; 16 17 /** 18 大于sqrt(maxvalue)的x, 19 肯定是其它数到x,到从x到其它数 20 21 计数 用 整除分块 22 **/ 23 24 int main() 25 { 26 ll n,siz,mid,mmid,l,r,i,j,g=0,sum=0; 27 scanf("%lld%lld",&siz,&n); 28 mmid=sqrt(siz+eps); 29 mid=siz/(mmid+1); 30 g=0; 31 for (l=1;l<=siz;l=r+1) 32 { 33 ///[l,r] 34 r

Codeforces Contest 1107 problem G Vasya and Maximum Profit―― 枚举每个不可控制的量找它所对应区间的数的最大值

匿名 (未验证) 提交于 2019-12-02 23:06:17
Vasya got really tired of these credits (from problem F) and now wants to earn the money himself! He decided to make a contest to gain a profit. Vasya has n problems to choose from. They are numbered from 1 to n. The difficulty of the i-th problem is di. Moreover, the problems are given in the increasing order by their difficulties. The difficulties of all tasks are pairwise distinct. In order to add the i-th problem to the contest you need to pay ci burles to its author. For each problem in the contest Vasya gets a burles. In order to create a contest he needs to choose a consecutive

2018 Multi-University Training Contest 1(补题)

匿名 (未验证) 提交于 2019-12-02 22:56:40
又到了hdu多校的季节,废话不多时,开始上代码 A题 Maximum Multiple Problem Description Given an integer n , Chiaki would like to find three positive integers x , y and z such that: n = x + y + z , x n , y n , z n and x y z is maximum. Input There are multiple test cases. The first line of input contains an integer T (1≤ T ≤106), indicating the number of test cases. For each test case: The first line contains an integer n (1≤ n ≤106). Output For each test case, output an integer denoting the maximum x y z Sample Input 3 1 2 3 Sample Output -1 -1 1 题目大意:给你一个数n,让你自己找三个数x,y,z,满足 n = x + y + z , x n , y n , z n(这三个数都能整除n

2018 Multi-University Training Contest 1 1001 Maximum Multiple

匿名 (未验证) 提交于 2019-12-02 22:56:40
Problem Description Input Output Sample Input 3 1 2 3 Sample Output -1 -1 1 注意!cin容易导致TLE,解决方法是加上std::ios::sync_with_stdio(false);或直接使用scanf 注意long long和int的一些陷阱!! 文章来源: 2018 Multi-University Training Contest 1 1001 Maximum Multiple