杭电2019多校第八场 Acesrc and Good Numbers——思维打表&&oeis
2024-08-27 08:26:58
题意
给定 $d,x$,$f(d,k)$ 表示 $1 \sim k$ 中 $d$ 出现的次数, $k$ 满足 $f(d,k) = k$,求小于 $x$ 的最大的 $k$.
分析
正解不会...,学习了oeis大法。
打表得到前几个数字,然后取oeis上找完整的。
之所以能这么做,是因为 $k$ 只有有限个。其中最大是 $d=8$,也只有344个 (oeis A130430)。
#include <bits/stdc++.h>
using namespace std; typedef long long ll;
ll a[][] = {
{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,},
{,,,,},
{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,},
{,,,,,,,,}}; ll d, x; int main()
{
int T;
scanf("%d", &T);
while(T--)
{
scanf("%lld%lld", &d, &x);d--;
ll ans = ;
for(int i = ;i < ;i++)
if(a[d][i] <= x) ans = max(ans, a[d][i]);
printf("%lld\n", ans);
}
return ;
}
参考链接:https://blog.csdn.net/lgz0921/article/details/99609356
最新文章
- 逗号分割符--字段中含逗号等情况的解析方法Java实现
- tomcat 增加压缩设置
- JSON日期格式处理
- cordova ios --->;OC 调用 js (一)
- iOS -数据持久化之CoreData
- JAVA取整以及四舍五入
- java打印各种菱形
- jsonarray和jsonobject
- Mysql 随机查询数据
- Markdown: 编译pdf
- springmvc注入类 NoUniqueBeanDefinitionException: No qualifying bean of type [] is defined: expected single错误
- Netbeans文件被误删怎么办?
- C语言之插入排序
- jfinal的回滚
- Project file is incomplete. Expected imports are missing 错误解决方案
- 《Pro SQL Server Internals, 2nd edition》
- windows10企业版2016长期服务版激活
- 一个简单至极的PHP缓存类代码
- Python代码统计工具
- 在linux系统中安装VSCode(Visual Studio Code)和图标的创建方式