[hdu3943]K-th Nya Number】的更多相关文章

K-th Nya Number Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 3943 64-bit integer IO format: %I64d      Java class name: Main Arcueid likes nya number very much.A nya number is the number which has exactly…
挺正常的一道模板题. f[i][j][k]表示i位的数,有j个4,k个7的方案数. 具体实现的话...我写了发二分答案..需要注意的是二分时应该是mid=L+(R-L)/2..不然分分钟爆longlong(unsigned long long党自行退散 其实也可以从左端点开始慢慢爬...但总觉得比较蛋疼所以没敢写 由网上题解可得,其实还可以确定答案的位数后,从高位往低位一个一个试= =...复杂度会比二分答案的少个log 需要注意一下对0的特判.. 对于从左端点爬到根再爬到右端点的奇怪姿势一直不…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3943 题目大意:求出区间 (P,Q] 中找到第K个满足条件的数,条件是该数包含X个4和Y个7 Sample Input 1 38 400 1 1 10 1 2 3 4 5 6 7 8 9 10   Sample Output Case #1: 47 74 147 174 247 274 347 374 Nya! Nya! 分析一: 先预处理dp[i][j][k]表示第 i 位有 j 个4和 k 个7…
Supreme Number A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying two smaller natural numbers. Now lets define a number N as the supreme number if and only if each number made up of an non-empty subse…
You've got a string s = s1s2... s|s| of length |s|, consisting of lowercase English letters. There also are q queries, each query is described by two integers li, ri (1 ≤ li ≤ ri ≤ |s|). The answer to the query is the number of substrings of string s…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 显然每个数字只可能是1,3,5,7 然后如果3,5,7这些数字出现两次以上.显然两个3||5||7都能被11整除. 然后1的话最多能出现两次. 那么也就是说最多只可能有5位数字. 把小于等于5位的全都枚举一遍.求出合法的就好. 如果n>=5位就直接输出那个最大的就Ok. [代码] #include <bits/stdc++.h> #define LL long long #define rep1(i,a,b) for (…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5981 题意:A在[L, R]之间随机选取一个数X,之后B来猜这个数,如果猜的数比X小,那么A就告诉B猜小了,如果猜的数大于X,那么以后A永远只会回答B是否猜对了,问在最坏的情况下B至少要猜多少次,并求出有多少种方案. 题解:参考自:https://blog.csdn.net/jaihk662/article/details/77435217     补充关于猜测次数的理解:如果第一次猜测的数大于等于…
package com.code; public class Test05_1 { public static int solution(int A, int B, int K) { // handle 6,8,7 condition // handle 6,11,2 condition // handle 7,12,3 condition if(A%K==0){ return (B-A)/K + 1; }else{ int start = A+(K-A%K); if(start>B){ //…
The k-th Largest Group Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 8807   Accepted: 2875 Description Newman likes playing with cats. He possesses lots of cats in his home. Because the number of cats is really huge, Newman wants to g…
传送门 The k-th Largest Group Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 8690   Accepted: 2847 Description Newman likes playing with cats. He possesses lots of cats in his home. Because the number of cats is really huge, Newman wants…