数学

其实我们发现不用每个数都去试一下,只要确定每个数字有几个就可以确定这个数。所以我们先搜索一下,然后检验。

但是这样太慢了,所以我们打表。

打出1-30的结果,然后取模。

打表的程序好像弄丢了。。。就是要各种高精度

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll ans, p;
string s[] = {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""};
int main()
{
scanf("%d%lld", &n, &p);
for(int i = ; i < s[n - ].length(); ++i)
ans = (ans * + s[n - ][i] - '') % p;
printf("%lld\n", ans);
return ;
}

bzoj3662的更多相关文章

随机推荐

  1. mysql运维常用

    一.用户授权 用户授权主要指: 1.可以限制用户访问那些库.表 2.可以限制用户对库.表执行select.create.delete.alter.drop等操作 3.可以限制用户登陆的IP.IP段.或 ...

  2. The content of element type "resultMap" must match ...

    mybatis中的mapper文件错误 ①错误原因: <resultMap>标签中需要按照一下顺序编写: <id> <result> <association ...

  3. python_ 学习笔记(运算符)

    python的运算符基本和C语言一致,以下说一些不一样的! 算术运算符 **:代表乘方,对应也有**=: //:代表商向下取整,对应也有//=: 逻辑运算符 and or not 位运算符 :& ...

  4. MySql-了解存储引擎

    怎么应对不同版本 在不同的 mysql 版本中,很多特性和语法有可能是不一样的,我们怎么样才能知道当前版本的语法是什么样呢?最好的办法是学会使用 mysql 的帮助. A.按照层次看帮助 例如:mys ...

  5. linux diff-比较给定的两个文件的不同

    推荐:更多Linux 文件查找和比较 命令关注:linux命令大全 diff命令在最简单的情况下,比较给定的两个文件的不同.如果使用“-”代替“文件”参数,则要比较的内容将来自标准输入.diff命令是 ...

  6. buf.readUIntBE()

    buf.readUIntBE(offset, byteLength[, noAssert]) buf.readUIntLE(offset, byteLength[, noAssert]) offset ...

  7. 第一个Maven工程的目录结构和文件内容及联网问题

    [第一个Maven工程] ①目录结构 Hello |---src |---|---main |---|---|---java |---|---|---resources |---|---test |- ...

  8. better-scroll & scroll

    scroll better-scroll https://github.com/ustbhuangyi/better-scroll/blob/master/README.md#getting-star ...

  9. Codeforces 158B (数学)

    B. Mushroom Scientists time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  10. Inversion

    Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 4176   Accepted: 1857 Description The i ...