上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 46 下一页
摘要: lcm: 传送门 找到以下代码的结果: long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) == 阅读全文
posted @ 2020-10-30 00:17 lipu123 阅读(146) 评论(0) 推荐(0) 编辑
摘要: L1-046 整除光棍 (20分) 这里所谓的“光棍”,并不是指单身汪啦~ 说的是全部由1组成的数字,比如1、11、111、1111等。传说任何一个光棍都能被一个不以5结尾的奇数整除。比如,111111就可以被13整除。 现在,你的程序要读入一个整数x,这个整数一定是奇数并且不以5结尾。然后,经过计 阅读全文
posted @ 2020-10-26 22:58 lipu123 阅读(523) 评论(0) 推荐(0) 编辑
摘要: 传送门 题意就是: 给你一个n*m的矩阵,矩阵中有W(向上),A(向左),S(向下),D(向右) 就是问你有多少个点能做出去(按他给的方向) 解析: 就是反向跑了一个dfs,让最外面的跑如果能跑出去,就反向把他所有的路径都跑出来; #include<iostream> #include<algori 阅读全文
posted @ 2020-10-25 23:30 lipu123 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 小 A 有 m 个格子从左到右排开,同时有 n 种球,编号 1⋯n ,每个格子可以(且必须)放一种球。 当 对于每一个格子 i, i 右边所有格子中球的编号都不小于 i 中球的编号 时,小 A 会认为这种放球方案是合理的。 请你求出有多少种会让小 A 认为合理的方案,方案数对 99824435399 阅读全文
posted @ 2020-10-25 23:25 lipu123 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 输入格式 第一行两个正整数 。 输出格式 第一行输出答案。 样例 输入样例 5 2 输出样例 63 参考博客 该题目式一个数论分块加筛法,当然快速幂加数论分块也能过 就是考虑n的一个因子的d在整个函数中的贡献是多少。 套上数论分块的思想,一个因子d对式子的贡献是⌊n/d⌋×d^k。 这样我们需要处理 阅读全文
posted @ 2020-10-25 10:20 lipu123 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 佩尔方程 解决问题: 一般解决中解的问题。在大多数的时候都不会给你这个式子,要有你自己来推成这个形式。 一定要注意当n为平方数的时候无解 解决方法: 一般都要你推出最小解(可以用程序跑出来第一个),计为(x[1],y[1])。然后再用递推公式来求解 佩尔方程求解: x^2 - n*y^2 = 1 x 阅读全文
posted @ 2020-10-21 23:14 lipu123 阅读(1130) 评论(0) 推荐(0) 编辑
摘要: 组合数的求法 1.打表法 //组合数打表模板,适用于N<=3000 //c[i][j]表示从i个中选j个的选法。 long long C[N][N]; void get_C(int maxn) { C[0][0] = 1; for(int i=1;i<=maxn;i++) { C[i][0] = 1 阅读全文
posted @ 2020-10-19 20:16 lipu123 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Arup has to make many practice questions for his Computer Science 1 students. Since many of the questions deal with arrays, he has to generate arrays 阅读全文
posted @ 2020-10-11 10:03 lipu123 阅读(305) 评论(0) 推荐(0) 编辑
摘要: Henry profiles a high load database migration script. The script is the list of n transactions. The i-th transaction consists of ai queries. Henry want 阅读全文
posted @ 2020-10-11 09:46 lipu123 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Every day a new programming problem is published on Codehorses. Thus, n problems will be published in the following n days: the difficulty of the i-th p 阅读全文
posted @ 2020-10-11 09:40 lipu123 阅读(275) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 46 下一页