Description New Year is coming! Our big boss Wine93 will distribute some “Red Package”, just like Alipay and Wechat. Wine93 has m yuan, he decides to distribute them to n people and everyone can get some money(0 yuan is not allowed and everyone’s mon…
[1651] Red packet 时间限制: 1000 ms 内存限制: 65535 K 问题描述 New Year is coming! Our big boss Wine93 will distribute some “Red Package”, just like Alipay and Wechat. Wine93 has m yuan, he decides to distribute them to n people and everyone can get some money(0…
新年抢红包效果(New Year Red Packet) 晓娜的文章(微信公众号:migufe) 2016即将过去,我们将迎来新的一年2017,这里小编提前祝大家新年快乐!万事如意!那我们新年最开心的事是什么呢,没错,我想要说的就是“抢红包”,家人群,朋友群,同事群,新年如果不抢几个红包,那真是好像失去了天大的乐趣. 下面我就分享一个简单的拆红包特效,最终结果就是下图: 代码实现: HTML代码部分 HTML代码比较简单,短短几行代码就全部可以搞定. CSS代码部分 因为本身红包就图个喜庆,颜色…
1. while循环: 当选循环下求百鸡百钱:如下: 代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><me…
Marriage Match IV 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/Q Description Do not sincere non-interference. Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A and girls a…
Black Box Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8637   Accepted: 3542 Description Our Black Box represents a primitive database. It can save an integer array and has a special i variable. At the initial moment Black Box is empt…
求一组N个数中的第k个最大者,设k=N/2. import java.util.Random; public class K_Max { /** * @param args */ //求第K大的数,保证K大于等于1,小于等于array.length/2哦 public static int TopK(int array[],int K) { int topk[] = new int [K]; for(int i = 0; i<topk.length;i++) topk[i] = array[i]…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1568 题意:如标题所示,求斐波那契数前四位,不足四位直接输出答案 斐波那契数列通式: 当n<=20的时候,不足四位,所以直接打表. 当n>20的时候,大于四位的时候,ans满足这个公式:ans=-0.5*log10(5.0)+num*1.0*log10((1+sqrt(5.0))/2.0); 这个公式是怎么来的呢?我们可以对an取10的对数,根据对数的性质. log10(ans)=log10(1/…
求1~n内全部数对(x,y),gcd(x,y)=质数,的对数. 思路:用f[n]求出,含n的对数.最后用sum[n]求和. 对于gcd(x,y)=a(设x<=y,a是质数),则必有gcd(x/a,y/a)=1;所以我仅仅要枚举i(设i=y/a),再枚举全部质数 他们乘积的f[i*a]值包含i的欧拉函数值. 时间复杂度(n*质数个数) #include<iostream> #include<cstring> using namespace std; const int maxx…
传送门 Description There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Exampl…