HDU 6124 Euler theorem】的更多相关文章

Euler theorem 思路:找规律 a       余数                  个数 1       0 1                     2 2       0 2                     2 3       0 1 3                  3 4       0 1 4                  3 5       0 1 2 5               4 6       0 1 2 6               4…
HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the value of b and only remember the value of a, please tell him the number of different possible results. Input The first line contains a positive integ…
Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the value of b and only remember the value of a, please tell him the number of different possible results.   Input The first line con…
[Link]:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1005&cid=765 [Description] 问你a%b的结果有多少种. b未知,可以为任意数字. [Solution] b=a+1,a,a-1,a-2-. 分别对应了a%b==a,0,1,2,- 且当b = a/2时,a%b会出现重复.. 找一下a为奇数和偶数的两种情况. 发现规律就是(a-1)/2 + 2; [NumberOf WA] 0 [Reviw]…
题目链接 快速求出a到b之间所有数的欧拉函数. 一个一个求肯定是不行的, 我们知道欧拉函数的公式为phi(n) = n*(1-1/i1)*(1-1/i2).......i1, i2为素因子. 那么我们就可以先将每一个数的欧拉函数值预处理出来. 具体看代码 #include<bits/stdc++.h> using namespace std; #define pb(x) push_back(x) #define ll long long #define mk(x, y) make_pair(x…
2017-09-22 21:59:43 writer:pprp HazelFan is given two positive integers a,ba,b, and he wants to calculate amodbamodb. But now he forgets the value of bb and only remember the value of aa, please tell him the number of different possible results. Inpu…
直接打表找规律 HazelFan is given two positive integers a,ba,b, and he wants to calculate amodbamodb. But now he forgets the value of bb and only remember the value of aa, please tell him the number of different possible results. InputThe first line contains…
Euler theorem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amodb.…
HDU6121 Build a tree 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6121 题目意思:一棵 n 个点的完全 k 叉树,结点标号从 0 到 n - 1,求以每一棵子树的大小的异或和. 思路:一层一层的算,附上我的灵魂画作 我们来模拟计算一下上面这个非完全k叉树所有子树的大小异或之和. 对于第四层对于以该层节点为根的子树的大小为1,我们发现这一层总共有12个这样的子树,所以ans+=0: 对于第三层对于以该层节点为根的子树的大小为…
Euler theorem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 742    Accepted Submission(s): 584 Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amod…