题意

给定 $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

最新文章

  1. 逗号分割符--字段中含逗号等情况的解析方法Java实现
  2. tomcat 增加压缩设置
  3. JSON日期格式处理
  4. cordova ios ---&gt;OC 调用 js (一)
  5. iOS -数据持久化之CoreData
  6. JAVA取整以及四舍五入
  7. java打印各种菱形
  8. jsonarray和jsonobject
  9. Mysql 随机查询数据
  10. Markdown: 编译pdf
  11. springmvc注入类 NoUniqueBeanDefinitionException: No qualifying bean of type [] is defined: expected single错误
  12. Netbeans文件被误删怎么办?
  13. C语言之插入排序
  14. jfinal的回滚
  15. Project file is incomplete. Expected imports are missing 错误解决方案
  16. 《Pro SQL Server Internals, 2nd edition》
  17. windows10企业版2016长期服务版激活
  18. 一个简单至极的PHP缓存类代码
  19. Python代码统计工具
  20. 在linux系统中安装VSCode(Visual Studio Code)和图标的创建方式

热门文章

  1. twemproxy配置
  2. C++ 计算定积分、不定积分、蒙特卡洛积分法
  3. 剑指offer27:按字典序打印出该字符串中字符的所有排列
  4. Linux基础-11-rpm管理软件包
  5. python内置模块介绍(一)
  6. Asp.netCore 的Startup 不继承接口
  7. vue+axios通过formdata提交参数和上传文件
  8. django css
  9. PimaIndiansdiabetes-数据预处理实验(一)
  10. c# 虚属性