HDU 5665 Lucky】的更多相关文章

Lucky 题目链接: http://acm.hust.edu.cn/vjudge/contest/123316#problem/G Description Chaos August likes to study the lucky numbers. For a set of numbers S,we set the minimum non-negative integer,which can't be gotten by adding the number in S,as the lucky…
看有没有0和1,都有的时候是YES,否则是NO #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<algorithm> using namespace std; int flag1, flag2; int main() { int T,n; scanf("%d", &T); while (T--) { flag1 =…
Lucky Coins 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5985 Description Bob has collected a lot of coins in different kinds. He wants to know which kind of coins is lucky. He finds out a lucky kind of coins by the following way. He tosses all th…
Lucky Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 294    Accepted Submission(s): 49 Problem Description “Ladies and Gentlemen, It’s show time! ” “A thief is a creative artist who ta…
Lucky Problem Description WLD is always very lucky.His secret is a lucky number K.k is a fixed odd number. Now he meets a stranger with N numbers:a1,a2,...,aN.The stranger asks him M questions.Each question is like this:Given two ranges [Li,Ri] and […
水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; int T; ; ]; int tot; int main() { scanf("%d",&T); while(T--){ flag=;tot=; scanf("%d",&n); ==) flag=; else{ w…
http://acm.split.hdu.edu.cn/showproblem.php?pid=5985 题意:有多种类型的硬币,每种类型的硬币都有一定的数量,现在每次抛硬币,除去朝下的硬币,知道最后只剩下一个硬币或者没有硬币,最后的硬币便是幸运硬币,求每种类型硬币成为幸运硬币的概率. 思路: 硬币的概率都是单独的,所以我们只需要计算一个硬币的概率情况即可. 设die[i][k]表示第i种硬币在第k次全部被抛弃的概率,易得,用alive[i][k]表示第i种硬币在第k次至少有一个存活的概率就是$…
Lucky Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 138    Accepted Submission(s): 96 Problem Description Chaos August likes to study the lucky numbers. For a set of numbers S,we set the minim…
思路:先枚举  a*bas +b = n  求出 bas 在sqrt(n)到n的  (bas>a&&bas>b) 再枚举  a*bas*bas+b*bas+c =n  求出bas 在 n^(1/3) 到sqrt(n)的 (bas >a&&bas>b&&bas>c) 上面 a b c  均只有  3 4 5 6  四种取值. 剩下的  直接   n^(1/3) 枚举   效率为  n的三分之一 次方. //============…
题目 参考自博客:http://blog.csdn.net/a601025382s/article/details/38517783 //string &replace(iterator first0, iterator last0,const_iterator first, const_iterator last); //把[first0,last0)之间的部分替换成[first,last)之间的字符串 /* 题意: 我们将3,4,5,6认为是幸运数字.给定一个十进制数n. 现在可以讲起任意转…
题目链接 题意 : 给定一个十进制n,让你转化成某个进制的数,让这个数只包含3 4 5 6这些数字,这个进制就成为n的幸运数字,输出有多少幸运数字,例如19,5进制表示是34,所以5是19的一个幸运数. 思路 : 以下思路有这里提供 先考虑特殊情况,所情况下会有无穷个?只有n=3,4,5,6的时候,因为这几个数在大于n的进制下都是他本身..注意特殊情况不包括33,343这些(我一开始就死在这里了,wa了三次).因为33在34进制下就不是33了(类似于10在16进制下就是A了). 我们知道n=a0…
虽然算法清晰的不能再清晰,但是实现总是边角料错这错那. 题目大意: 给出n,找出一些进制,使得n在该进制下仅为3,4,5,6表示 解题思路: 首先,4-10000进制直接枚举计算出每一位 此外,最多只有3位,因为10000进制以上且小于1e12,最多3位,直接枚举每一位计算进制N即可 注意:如果类似我用二分或者直接求二次根式,要开个map储存已经计算出来的N进行判重,虽然数据比较弱可以不用判.最多4^3个吧,多了可能会重. #include <cstdio> #include <cstr…
把全部合法的进制打出来会发现合法的进制都是在 n/3 n/4 n/5的边上 然后暴力边上的进制数.. #include <cstdio> #include <set> typedef long long ll; bool ok(ll x, ll y) { ll v; while (x > 0) { v = x % y; if (v != 3 && v != 4 && v != 5 && v != 6) return false;…
题目链接 \(Description\) 有n(n<=10)种硬币,已知每种硬币的数量和它抛一次正面朝上的概率pi.进行如下过程:每次抛一次所有硬币,将正面朝下的硬币去掉.重复该过程直到只剩一种硬币或是没有硬币. 如果结束时还剩下一种硬币,那称它是 \(LuckyCoin\).求每种硬币成为 \(LuckyCoin\) 的概率. \(Solution\) 我们只需要枚举在第j轮,硬币i死亡(这个词形象233),其它硬币在第j轮之前死亡的概率. 由给出的概率及六位小数可以看出,枚举到100轮就很够…
题意: 给你一个数,求在多少种不同的进制下这个数每一位都是3.4.5.6中的一个. 思路: 搜索.枚举这个数在任意进制下的表示,判断是否合法.当数字只有3.4.5.6时,必定有无穷种. 因为数字太大,所以直接枚举必定会超时. 下面有两种剪枝的方法: 1. 先枚举最后一位的情况. 假设数字n在base进制下表示为 a[n]...a[0],即 n = a[0] + a[1]*base^1 + ... + a[n]*base^n. 则 n - a[0] = a[1]*base^1 + ... + a[…
摘要 本文主要列举并求解了2016 ACM/ICPC亚洲区青岛站现场赛的部分真题,着重介绍了各个题目的解题思路,结合详细的AC代码,意在熟悉青岛赛区的出题策略,以备战2018青岛站现场赛. HDU 5984 Pocky 题意 给出一根棒子(可以吃的)的长度x和切割过程中不能小于的长度d,每次随机的选取一个位置切开,吃掉左边的一半,对右边的棒子同样操作,直至剩余的长度不大于d时停止.现在给出x和d,问切割次数的数学期望是多少. 解题思路 当看到第二个样例2 1时,结果是1.693147,联想到ln…
题目链接:hdu 5676 一开始看题还以为和数位dp相关的,后来才发现是搜索题,我手算了下,所有的super lucky number(也就是只含数字4, 7且4, 7的数量相等的数)加起来也不过几万个,可以采用打表的方法来把所有的super lucky number存储起来.因为4,7数量须相等,所以可以用一个二进制数的0,1来代替,先限定4,7数量分别为 i,之后就是求出包含 i 个0和 i 个1的 2*i 位所有这样的二进制数,然后简单转换一下(1->7, 0->4,这样子能从小到大…
题目链接:https://www.nowcoder.com/acm/contest/207/D 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5985 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述 Bob has collected a lot of coins in different kinds. He wants to know which…
ztr loves lucky numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/I Description ztr loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For…
Problem Description ztr loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Lucky number is…
ztr loves lucky numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1834    Accepted Submission(s): 707 Problem Description ztr loves lucky numbers. Everybody knows that positive integers ar…
题目链接; http://acm.hdu.edu.cn/showproblem.php?pid=5676 题意: 由4和7组成的且4和7出现次数相同的数称为幸运数字,给定n,求不大于n的最大幸运数字. 分析: 可以对于每个数都按位dfs找一发.一旦发现当前位无法满足就回溯,直到找到满足条件的最小的. 也可以先按位dfs把所有结果都找出来存起来,然后对于每个询问直接二分即可.注意边界时会爆long long,注意处理. 代码: #include<cstdio> #include<cstri…
WLD is always very lucky.His secret is a lucky number . is a fixed odd number. Now he meets a stranger with numbers:.The stranger asks him questions.Each question is like this:Given two ranges and ,you can choose two numbers and to make .The you can…
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201…
hdu 2647 Reward Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble…
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 20680    Accepted Submission(s): 6852 Problem Description Ignatius is so lucky that he met a Martian yesterday. But…
http://acm.hdu.edu.cn/showproblem.php?pid=5768 Lucky7 Problem Description   When ?? was born, seven crows flew in and stopped beside him. In its childhood, ?? had been unfortunately fall into the sea. While it was dying, seven dolphins arched its bod…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8595    Accepted Submission(s): 3957 Problem Description Now,given…
http://acm.hdu.edu.cn/showproblem.php?pid=1075 What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 13618    Accepted Submission(s): 4366 Problem Description Ignatius is…
http://acm.hdu.edu.cn/showproblem.php?pid=4617 三维几何简单题 多谢高尚博学长留下的模板 代码: #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; typedef pair<…