UVaLive 6847 Zeroes (找规律,水题)】的更多相关文章

题意 :给定一个范围,然后让你求在这个范围内所有的数的阶乘末尾0的个数有多少种. 析:找规律,写几个就会发现每隔5个会增加一个0,因为要么乘10了,要么乘5了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #inclu…
题目 链接 题意:给出x数列的定义: $T_0 = a$ $T_1 = b$ $T_n = T_{n-2} \bigoplus T_{n-1} $ 求第 $n$ 项( $0 \leqslant a,b,c \leqslant 10^{18} $) 分析 $n$ 这么大,肯定是常数时间复杂度. 打表找规律,能发现循环节为3. 或者直接推导,$a \bigoplus b = c, \ b \bigoplus c = a, \ c \bigoplus a = b$ #include<bits/stdc…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5919 题意: 给出正整数 $N(1 \le N \le 10^5)$,询问对于正整数 $k$,有多少个小于 $2^N$ 的 $2^k-1$ 是 $7$ 的整数倍. 题解: $…
A. Little Pony and Expected Maximum Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/453/problem/A Description Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing.…
题意:略. 析:不解释,水题. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set>…
Close Enough Computations 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2193 Descriptionww.co The nutritional food label has become ubiquitous. A sample label is shown to the right…
题意:给出一棵二分搜索树,再给一个节点编号n,求以这个节点为根节点的子树叶子节点的最大值与最小值. 首先求n所在的层数,他的层数就是他的因子中2的个数(规律). n的左右各有num=2^i-1个数.最小值是n-num,最大值是n+num #include <iostream> #include <algorithm> #include <stdio.h> #include <string.h> #include <queue> using nam…
就是统计入度为0 的点 和 出度为0 的点  输出 大的那一个,, 若图中只有一个强连通分量 则输出0即可 和https://www.cnblogs.com/WTSRUVF/p/9301096.html  这题差不多  poj1236 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set…
题意:n个工人,有n件工作a,n件工作b,每个工人干一件a和一件b,a[i] ,b[i]代表工作时间,如果a[i]+b[j]>t,则老板要额外付钱a[i]+b[j]-t;现在要求老板付钱最少: 析:贪心策略,让大的和小的搭配,小的和大的搭配,是最优的. #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include &l…
Dice Cup 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/D Description In many table-top games it is common to use different dice to simulate random events. A "d" or "D" is used to indicate a die with a specific number of fa…