数学
文章平均质量分 70
kingsirre
fighting
展开
-
hdu1014 Uniform Generator
Problem DescriptionComputer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the formseed(x+1) = [seed(x) + STEP] % MODwhere '%' is th原创 2015-08-22 20:10:24 · 250 阅读 · 0 评论 -
hdu5479
题目:点击打开链接题解:不能用栈,会爆栈全部转化成不匹配,要不就是全化为((((或))))或))))((((这三种情况必居其一思路是从左到右和从右到左各扫描一次记录 ( 和 ) 的到每个位置的数量,求将每个位置左方全转置成 ) 和右方全转置成 ( 需要的次数和,这么算发现有一个转置是不必要的,注意减一代码:#include #include #i原创 2015-10-25 16:30:54 · 331 阅读 · 0 评论 -
hdu5480
题目:点击打开链接题解:这道题不能开那么大的二维数组,所以得想个其他办法可以发现如果一个矩阵被全部攻击到, 很显然要么是因为它的每一行都有车, 或者每一列都有车。所以只需要记录一下哪些行和哪些列有车 对于每个询问只需要做一个前缀和就可以知道答案了。#include #include #include #include usin原创 2015-10-24 21:06:32 · 319 阅读 · 0 评论 -
hdu5505
题目:点击打开链接题解:给你2个数n,m,n每次都能乘以它的一个因子成为新的n,问你n至少乘多少次能够变成m,如果不能的话就输出-1。如果n能变成m话,m肯定是n的整数倍,初始的n乘以多个因子变成m,那么那些因子的乘积就是m/n,也就是n*(m/n)=m,所以每次都找到k=gcd(n,m/n),然后n=n*k,(m/n)=(m/n)/k,直到n=m。如果k=1的话,n也原创 2015-10-23 20:09:15 · 433 阅读 · 0 评论 -
hdu1133
题目链接:点击打开链接多次才对的题#include#include#define N 100int a[N+1];void das(int x){ a[N]=1; for(int i=1;i<=x;i++) { int ad; for(int j=N,ad=0;j>=0;j--) {转载 2015-10-01 17:40:06 · 329 阅读 · 0 评论 -
hdu1021Fibonacci Again
Problem DescriptionThere are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). InputInput consists of a sequence of lines, each containing an integer n原创 2015-08-21 20:55:38 · 268 阅读 · 0 评论 -
hdu1019
Problem DescriptionThe least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 1原创 2015-08-21 20:25:23 · 268 阅读 · 0 评论 -
hdu1163 Eddy's digital Roots
Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resultin原创 2015-08-28 10:15:35 · 239 阅读 · 0 评论 -
hdu 5373 The shortest problem
Problem DescriptionIn this problem, we should solve an interesting game. At first, we have an integer n, then we begin to make some funny change. We sum up every digit of the n, then insert it to th原创 2015-08-26 10:47:59 · 307 阅读 · 0 评论 -
hdu 5407CRB and Candies
Problem DescriptionCRB has N different candies. He is going to eat K candies.He wonders how many combinations he can select.Can you answer his question for all K(0 ≤ K ≤ N)?CRB is too转载 2015-08-24 17:11:14 · 349 阅读 · 0 评论 -
**hdu5495
题目:点击打开链接题解:a[i]和b[i]对应的值无论怎么移动都是一一对应的目前想的还不是很明白,过两天想明白了过来更新#include #include #include #include #include using namespace std;int main(){ int t,n; int a[100001],b[100转载 2015-10-24 16:57:10 · 305 阅读 · 0 评论