HDU5878(打表)
I Count Two Three
Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 348    Accepted Submission(s): 184
Problem Description
It all started several months ago.
We found out the home address of the enlightened agent Icount2three and decided to draw him out.
Millions of missiles were detonated, but some of them failed.
After the event, we analysed the laws of failed attacks.
It's interesting that the i-th attacks failed if and only if i can be rewritten as the form of 2a3b5c7d which a,b,c,d are non-negative integers.
At recent dinner parties, we call the integers with the form 2^a3^b5^c7^d "I Count Two Three Numbers".
A related board game with a given positive integer n from one agent, asks all participants the smallest "I Count Two Three Number" no smaller than n.
Input
Output
Sample Input
Sample Output
Source
//2016.9.17
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 10000
#define ll long long using namespace std; int arr[N]; ll pow(ll a, ll b)//快速幂
{
ll ans = ;
while(b)
{
if(b & )ans *= a;
a *= a;
b>>=;
}
return ans;
} int main()
{
ll tmp; int cnt = ;
for(int a = ; a < ; a++)
{
for(int b = ; b < ; b++)
{
for(int c = ; c < ; c++)
{
for(int d = ; d < ; d++)
{
tmp = pow(, a)*pow(, b);
if(tmp > 1e9)break;
tmp *= pow(, c);
if(tmp > 1e9)break;
tmp *= pow(, d);
if(tmp > 1e9)break;
arr[cnt++] = tmp;
}
}
}
}
sort(arr, arr+cnt);
int T, n;
scanf("%d", &T);
while(T--)
{
scanf("%d", &n);
int pos = lower_bound(arr, arr+cnt, n)-arr;
printf("%d\n", arr[pos]);
} return ;
}
HDU5878(打表)的更多相关文章
- 2016 ACM/ICPC Asia Regional Qingdao Online 1001/HDU5878 打表二分
		I Count Two Three Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ... 
- hdu5878(枚举,打表)
		题目链接:hdu5878 题意:到一行输入t,表示下面有t组数据,然后下面t行每行输入一个数n; 定义x==2^a*3^b*5^c*7^d(a, b, c, d为自然数,x不大于1e+9): 要求对于 ... 
- hdu5878 I Count Two Three(二分+ 打表)
		题目链接:hdu5878 I Count Two Three 题意:给出一个整数n, 找出一个大于等于n的最小整数m, 使得m可以表示为2^a * 3^b * 5^c * 7^d. 题解:打表预处 ... 
- In-Memory:在内存中创建临时表和表变量
		在Disk-Base数据库中,由于临时表和表变量的数据存储在tempdb中,如果系统频繁地创建和更新临时表和表变量,大量的IO操作集中在tempdb中,tempdb很可能成为系统性能的瓶颈.在SQL ... 
- In-Memory:内存优化表的事务处理
		内存优化表(Memory-Optimized Table,简称MOT)使用乐观策略(optimistic approach)实现事务的并发控制,在读取MOT时,使用多行版本化(Multi-Row ve ... 
- 试试SQLSERVER2014的内存优化表
		试试SQLSERVER2014的内存优化表 SQL Server 2014中的内存引擎(代号为Hekaton)将OLTP提升到了新的高度. 现在,存储引擎已整合进当前的数据库管理系统,而使用先进内存技 ... 
- SQL Server表分区
		什么是表分区 一般情况下,我们建立数据库表时,表数据都存放在一个文件里. 但是如果是分区表的话,表数据就会按照你指定的规则分放到不同的文件里,把一个大的数据文件拆分为多个小文件,还可以把这些小文件放在 ... 
- 一起学微软Power BI系列-使用技巧(5)自定义PowerBI时间日期表
		1.日期函数表作用 经常使用Excel或者PowerBI,Power Pivot做报表,时间日期是一个重要的纬度,加上做一些钻取,时间日期函数表不可避免.所以今天就给大家分享一个自定义的做日期表的方法 ... 
- 分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
		分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间) 很多时候我们都需要计算数据库中各个表的数据量和每行记录所占用空间 这里共享一个脚本 CREATE TABLE #tab ... 
随机推荐
- CSS——z-index
			1.特性 ①z-index的值表示谁压着谁.值大的压住值小的. ②只有定位的元素才有z-index 值,也就是说,浮动不可以,相对定位,绝对定位,固定定位都可以. ③z-index值没有单位,是一个正 ... 
- mysql基础-- 一条请求执行多条SQL语句
			最近做一个数据库初始化工具的时候发现了这个问题,就是在一个Statement中执行一条SQL语句的时候可以正确执行,如果同时执行多条,就会报SQL语法错误,伤透了脑筋. 经过网上查找,发现有两种解决办 ... 
- AWK----awk与shell交互
			1互相调用命令 ls | awk '{if(system("ls " $0)==0) print "file "$0" exsits"}' ... 
- Java将List/JavaBean转成Json
			import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.util.List; /** * ... 
- mysql数据库中间件研究
			随着互联网的发展,数据量的不断增大. 单台实例已经远远无法满足业务的需要. 对数据库分库分表的需求不断的增加随之而来的就是数据库中间件的开发. 一. 单台实例主要面临下面几个问题: 1. 数据量太大 ... 
- 小偷网站工具--Teleport Ultra
			可以克隆别人网站的工具 http://jingyan.baidu.com/article/219f4bf7dce58bde442d3836.html 
- Mysql导入zabbix的sql语句时报错:ERROR 1045 (28000)
			#Warning: Using a password on the command line interface can be insecure.#ERROR 1045 (28000): Access ... 
- iOS动画特效                                                    分类:            ios技术             2015-05-15 16:29    311人阅读    评论(0)    收藏
			关于图层的几个坐标系. 对于ios来说,坐标系的(0,0)点在左上角,就是越往下,Y值越大.越往右,X值越大. 一个图层的frame,它是position,bounds,anchorPoint和tra ... 
- Lambda表达式例子
			转 Lambda表达式例子 1.Java8 新特性介绍 写java的同学对java8肯定知道 那么java8到底有哪些特性呢,总结如下: Lambda表达式 函数式接口 Stream Optional ... 
- FTP-使用记录
			1.磁盘配额不够用 Could not write to transfer socket: ECONNABORTED - 连接中止 452-Maximum disk quota limited to ... 
