为甚么16年Qingdao Online 都是暴力题emm///。。。

先暴力预处理

然后lower _bound二分

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <cctype>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define rap(i, a, n) for(int i=a; i<=n; i++)
#define rep(i, a, n) for(int i=a; i<n; i++)
#define lap(i, a, n) for(int i=n; i>=a; i--)
#define lep(i, a, n) for(int i=n; i>a; i--)
#define rd(a) scanf("%d", &a)
#define rlld(a) scanf("%lld", &a)
#define rc(a) scanf("%c", &a)
#define rs(a) scanf("%s", a)
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = , INF = 0x7fffffff;
LL sum[maxn], cnt; LL inv(LL a, LL b)
{
LL res = ;
while(b)
{
if(b & ) res = res * a;
a = a * a;
b >>= ;
}
return res;
} void init()
{
rep(i, , )
{
int f1 = ;
rep(j, , )
{
int f2 = ;
rep(k, , )
{
int f3 = ;
rep(m, , )
{
LL res = ;
res *= inv(, i);
if(res > 1e9)
{
f1 = ;
break;
}
res *= inv(, j);
if(res > 1e9)
{
f2 = ;
break;
}
res *= inv(, k);
if(res > 1e9)
{
f3 = ;
break;
}
res *= inv(, m);
if(res > 1e9)
break;
sum[cnt++] = res;
}
if(f3) break;
}
if(f2) break;
}
if(f1) break;
}
} int main()
{
cnt = ;
init();
sort(sum, sum + maxn);
int T;
rd(T);
while(T--)
{
LL n;
rlld(n);
int res = lower_bound(sum, sum + maxn, n) - sum;
printf("%lld\n", sum[res]);
} return ;
}

I Count Two Three HDU - 5878(暴力二分)的更多相关文章

  1. poj3977 - subset - the second time - 暴力 + 二分

    2017-08-26 11:38:42 writer:pprp 已经是第二次写这个题了,但是还是出了很多毛病 先给出AC代码: 解题思路: 之前在培训的时候只是笼统的讲了讲怎么做,进行二分对其中一边进 ...

  2. HDU - 5878 2016青岛网络赛 I Count Two Three(打表+二分)

    I Count Two Three 31.1% 1000ms 32768K   I will show you the most popular board game in the Shanghai ...

  3. 数学--数论--hdu 5878 I Count Two Three(二分)

    I will show you the most popular board game in the Shanghai Ingress Resistance Team. It all started ...

  4. HDU 5878 I Count Two Three (打表+二分查找) -2016 ICPC 青岛赛区网络赛

    题目链接 题意:给定一个数n,求大于n的第一个只包含2357四个因子的数(但是不能不包含其中任意一种),求这个数. 题解:打表+二分即可. #include <iostream> #inc ...

  5. HDU 5878 I Count Two Three (预处理+二分查找)

    题意:给出一个整数nnn, 找出一个大于等于nnn的最小整数mmm, 使得mmm可以表示为2a3b5c7d2^a3^b5^c7^d2​a​​3​b​​5​c​​7​d​​. 析:预处理出所有形为2a3 ...

  6. hdu 5878 I Count Two Three (2016 ACM/ICPC Asia Regional Qingdao Online 1001)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 题目大意: 给出一个数n ,求一个数X, X>=n. X 满足一个条件 X= 2^a*3^ ...

  7. HDU 5878 I Count Two Three

    I Count Two Three Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  8. hdu 4750 Count The Pairs(并查集+二分)

    Problem Description With the 60th anniversary celebration of Nanjing University of Science and Techn ...

  9. I Count Two Three---hdu5878(打表+二分)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 题意:找到第一个>=n的数x, 满足 x = 2a3b5c7d:n<=1e9; 打表 ...

随机推荐

  1. WCF 学习笔记一

    wcf服务的细节: 1.新建项目的时候有wcf服务应用程序和wcf服务库,两者区别在于前者可以寄宿在IIS上,而后者只能给其他项目使用,可以寄宿在控制台程序.窗体程序等等. 相关定义的链接 http: ...

  2. ESP8266/ESP32模块晶振频偏调试

    ESP8266/ESP32模块晶振频偏调试 !> 前提:晶振频偏调试是需要仪器设备的支持才能完成的. 测试环境:IQ2010综合测试仪 本文仅记录有关频偏调试的主要内容,其余不在赘述. IQ20 ...

  3. Unity扩展编辑器五

    扩展系统自带组件Inspector ​ 可以在系统摄像机组建上添加一个按钮,这样就可以单独处理逻辑了 ​

  4. 在vsphere6.5启用Tesla K80

    基础环境: vsphere6.5 VMware vCenter6.5 宝德服务器2750S Tesla K80 0x01 选择主机,配置→硬件→PCI设备→添加K80显卡 注意:1.添加完显卡后,主机 ...

  5. 【LeetCode算法题库】Day3:Reverse Integer & String to Integer (atoi) & Palindrome Number

    [Q7]  把数倒过来 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Outpu ...

  6. Kettle日常使用汇总整理

    Kettle日常使用汇总整理 Kettle源码下载地址: https://github.com/pentaho/pentaho-kettle Kettle软件下载地址: https://sourcef ...

  7. python的Socket网络编程 使用模板

    本文给出的是TCP协议的Socket编程. 其中用了一个dbmanager数据库操作模块,这个模块是我自己定义的,可以在我的另一个文章中找到这个模块的分享.python操作mysql数据库的精美实用模 ...

  8. Description Resource Path Location Type Cannot change version of project fac

    http://www.cnblogs.com/eaysun/p/5661631.html

  9. Daily Scrum (2015/10/21)

    今天可以说是项目正式开始的第一天,由于大家缺乏做团队项目的经验,对TFS的使用都还不太熟悉,所以今天大家的主要工作是熟悉TFS的使用和对代码进行初步的理解.我们预计需要2-3天时间来理解透彻源代码.以 ...

  10. 20135313-exp1

    北京电子科技学院(BESTI) 实     验    报     告 课程:Java程序设计 班级:1353 姓名:吴子怡 学号:20135313 成绩:            指导教师:娄嘉鹏  实 ...