HDU-5878-I Count Two Three
来源:互联网 发布:linux 安装maven 编辑:程序博客网 时间:2024/05/16 01:19
ACM模版
描述
题解
预处理出来一些
代码
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int MAXN = 5555;const int MAXM = 4;int bs[MAXN] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};int tp[MAXM] = {2, 3, 5, 7};void init(){ int cnt; for (int i = 10; i < MAXN; i++) { cnt = i - 1; bs[i] = INT_MAX; for (int j = 0; j < 4; j++) { while (bs[cnt - 1] * tp[j] > bs[i - 1]) { cnt--; } bs[i] = min(bs[i], bs[cnt] * tp[j]); } }}int n;int main(){ init(); int t; cin >> t; while (t--) { scanf("%d", &n); int res = *lower_bound(bs, bs + MAXN, n); printf("%d\n", res); } }
阅读全文
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-预处理+二分
- Kotlin学习笔记(2)- 空安全
- Oracle之硬解析,软解析,软软解析
- 谷歌浏览器主页被hao.qquu8.com网址篡改了
- 给第三方apk进行系统签名的几种方式
- UVALive
- HDU-5878-I Count Two Three
- 我的学习之路_第二十章_JDBC
- 利用python编程实现两excel表格的快速信息融合(xls文件的读和写)
- Struts2-Action概述和在Action中访问WEB资源
- 用js面向对象写的选项卡
- 企业搭建私有云
- git log的常见用法
- EJB系列
- linkedblockingqueue