hdu 5878 I Count Two Three
来源:互联网 发布:软件开发速成 编辑:程序博客网 时间:2024/05/22 07:45
Problem Description
I will show you the most popular board game in the Shanghai Ingress Resistance Team.
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 thei -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 form2a3b5c7d "I Count Two Three Numbers".
A related board game with a given positive integern from one agent, asks all participants the smallest "I Count Two Three Number" no smaller than n .
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
At recent dinner parties, we call the integers with the form
A related board game with a given positive integer
Input
The first line of input contains an integer t (1≤t≤500000) , the number of test cases. t test cases follow. Each test case provides one integer n (1≤n≤109) .
Output
For each test case, output one line with only one integer corresponding to the shortest "I Count Two Three Number" no smaller than n .
Sample Input
1011113123123412345123456123456712345678123456789
Sample Output
11214125125012348123480123480012348000123480000
打表+二分;
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <stack>#include <vector>#include <queue>#include <set>#include <map>#include <string>#include <math.h>#include <stdlib.h>#include <time.h>using namespace std;#define LL long long#define N 100005#define mod 1000000007vector<LL> vec;vector<LL>::iterator it;void init(){ LL a=1,b=1,c=1,d=1; LL sum=0; for(int i=0;i<40;i++) { if(i) a*=2; else a=1; for(int j=0;j<40;j++) { if(j) b*=3; else b=1; for(int k=0;k<40;k++) { if(k) c*=5; else c=1; for(int l=0;l<40;l++) { if(l) d*=7; else d=1; sum=a*b*c*d; if(sum<1||sum>1000000000) break; vec.push_back(sum); } } } }}int main(){ int T; LL n; init(); sort(vec.begin(),vec.end()); cin>>T; while(T--) { scanf("%I64d",&n); it=lower_bound(vec.begin(),vec.end(),n); printf("%I64d\n",*it); }}
0 0
- hdu 5878 I Count Two Three
- 【30.53%】【hdu 5878】I Count Two Three
- HDU 5878 I Count Two Three .
- HDU 5878 - I Count Two Three
- HDU 5878 I Count Two Three
- HDU-5878-I Count Two Three
- 5878 I Count Two Three
- HDU 5878 I Count Two Three (dfs+二分)
- hdu 5878 I Count Two Three(二分)
- HDU 5878 I Count Two Three 2016青岛网赛
- hdu 5878 I Count Two Three 丑数
- HDU 5878 I Count Two Three (DFS预处理 + 二分)
- HDU-5878 I Count Two Three(打表)
- hdu 5878 I Count Two Three【预处理打表+二分】
- 【HDU 5878】I Count Two Three(预处理+二分)
- HDU 5878 I Count Two Three(打表加二分)
- hdu 5878 I Count Two Three 丑数 二分
- HDU-5878-I Count Two Three-预处理+二分
- Eclipse svn报文件夹 "" 已不存在 [转载]
- Hyperleger源码分析--共识算法
- 笔记
- Android 环形进度Progress
- linux札记
- hdu 5878 I Count Two Three
- tomcat结合nginx使用小结
- 回文
- SQL Server2012安装过程中提示需要更新的以前的VS2010的实例
- 关于JTCalendar的使用
- 关于使用Activex控件时,不能使用退格键的解决方法
- Oracle data import and export impl/exp
- 1-Two Sum
- Android编译系统详解(一)——build/envsetup.sh