- 博客(10)
- 收藏
- 关注
原创 Hdu 6069
Problem DescriptionIn mathematics, the function d(n) denotes the number of divisors of positive integer n.For example, d(12)=6 because 1,2,3,4,6,12 are all 12's divisors.In this prob
2017-08-05 16:16:17
221
原创 cf Star sky
C. Star skytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Cartesian coordinate system is set in the s
2017-08-05 16:11:38
342
原创 树状数组求逆序数
51 nod 10191019 逆序数基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。如2 4 3 1中,2 1,4 3,4 1,3
2017-07-18 11:54:00
456
原创 线性 素数筛
#include using namespace std;typedef long long ll;const ll Maxn=1000000+10;int prim[Maxn+100],used[Maxn+100],ans;void solve(){ for(long long i=2;i if(!used[i]){
2017-07-08 17:42:07
263
转载 素勾股数
以下的方法可用来找出勾股数。设 m > n 、 m 和 n 均是正整数,{\displaystyle a=m^{2}-n^{2}}{\displaystyle b=2mn}{\displaystyle c=m^{2}+n^{2}}若 m 和 n 是互质,而且 m 和 n 其中有一个是偶数,计算出来的 (a, b, c) 就是素勾股数。(若 m 和 n 都是奇数, (a, b,
2017-07-08 12:21:37
2090
转载 编程之美--数字1的个数
1位数的情况: 在解法二中已经分析过,大于等于1的时候,有1个,小于1就没有。 2位数的情况: N=13,个位数出现的1的次数为2,分别为1和11,十位数出现1的次数为4,分别为10,11,12,13,所以f(N) = 2+4。 N=23,个位数出现的1的次数为3,分别为1,11,21,十位数出现1的次数为10,分别为10~19,f(
2017-05-23 10:48:36
1025
转载 51 nod 1009
1位数的情况: 在解法二中已经分析过,大于等于1的时候,有1个,小于1就没有。 2位数的情况: N=13,个位数出现的1的次数为2,分别为1和11,十位数出现1的次数为4,分别为10,11,12,13,所以f(N) = 2+4。 N=23,个位数出现的1的次数为3,分别为1,11,21,十位数出现1的次数为10,分别为10~19,f(
2017-05-23 10:46:09
271
原创 51 nod 1080
给出一个整数N,将N表示为2个整数i j的平方和(i <= j),如果有多种表示,按照i的递增序输出。例如:N = 130,130 = 3^2 + 11^2 = 7^2 + 9^2 (注:3 11同11 3算1种)Input一个数N(1 Output共K行:每行2个数,i j,表示N = i^2 + j^2(0 <= i <= j)。如果无
2017-05-19 16:09:54
211
原创 51 nod 1082 与7无关的数
一个正整数,如果它能被7整除,或者它的十进制表示法中某个位数上的数字为7,则称其为与7相关的数。求所有小于等于N的与7无关的正整数的平方和。例如:N = 8,<= 8与7无关的数包括:1 2 3 4 5 6 8,平方和为:155。Input第1行:一个数T,表示后面用作输入测试的数的数量。(1<=T<=1000)第2-T+1行:每行1个数N。(1...
2017-05-19 10:01:44
257
原创 走楼梯可以走一步可以走两步
#include#include#include#include#includeusing namespace std;int len =0;int a[1000];void dfs(int deep){ if(deep return; } if(deep==0){ for(int i=0;i
2017-03-29 20:54:36
1454
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人