数学

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

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

打出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. MS SQL Server查询 本日、本周、本月、本季度、本年起始时间

    参数声明 declare @beginTime datetime, --查询开始时间 @endTime datetime, --查询结束时间 @queryTimeType tinyint; --查询时 ...

  2. spark学习(3)---集合

    一.list https://blog.csdn.net/xianpanjia4616/article/details/84930779 华为文档:https://support.huawei.com ...

  3. EXP-00083: 调用 EXFSYS.DBMS_EXPFIL_DEPASEXP.schema_info_exp 时出现前一问题

    select owner,object_name,object_type,status from dba_objects where object_name = 'LT_EXPORT_PKG'; 如果 ...

  4. NOIp2017——追求那些我一直追求的

    谨以此祭奠我即将爆炸的NOIP2017. $Mingqi\_H\ \ 2017.09.24$ Day -47 突然发现半年来自己从来没有写对过SPFA,最近几天才发现自己的板子一直是错的...赶紧找个 ...

  5. Eclipse添加背景图片

    ①前言:我本人是一个比较喜新厌旧的人,经常换头像,背景图片之类的,喜欢折腾,哈哈,所以每次都上网查怎么修改背景图片比较麻烦,这里也记录一下怎么修改. ②原文链接:https://yq.aliyun.c ...

  6. Mysql Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode

    今天用mysql workbench在更新数据的时候,出现了下面错误:15:52:39    update wp_posts set post_content = replace(post_conte ...

  7. (12)GrabCut前景提取

    import cv2 import numpy as np import matplotlib.pyplot as plt img = cv2.imread('opencv-python-foregr ...

  8. [bzoj 1042][HAOI2008]硬币购物(用容斥原理弄背包)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1042 分析: 解法很巧妙,用f[i]表示四种硬币A.B.C.D的数量不考虑的情况下弄成 ...

  9. Ubuntu中PPA源是什么

    以下内容转自https://imcn.me/ppa: PPA是Personal Package Archives首字母简写.翻译为中文意思是:个人软件包文档 只有Ubuntu用户可以用,而所有的PPA ...

  10. 配置类Configuration怎样使用

    public class CorsConfiguration { /** * Wildcard representing <em>all</em> origins, metho ...