题意:n和n+1同时被数位乘积整除的k位数个数。

假如a是237,b是238。由于个位以前的数一样。那么对于2,如果a%2==0,b%2就!=0,如果a%3==0,b%3就!=0。因此个位以前的数只能是1.再列举个位的情况。

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#define mkp make_pair
using namespace std;
const double EPS=1e-;
const int SZ=,INF=0x7FFFFFFF;
typedef long long lon;
int arr[SZ]; bool chk(const vector<int> &vct,int mod)
{
if(mod==||mod==||mod==)return ;
else if(mod==||mod==)return (vct.size()-)%mod==;
else if(mod==)return (vct.size()-)%==;
else
{
int res=;
for(int i=;i<vct.size();++i)
{
res=res*+vct[i];
res%=mod;
}
return res==;
}
} int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
lon casenum;
//cin>>casenum;
//for(lon time=1;time<=casenum;++time)
{
int n;
cin>>n;
vector<int> vct(n,);
for(int i=;i<;++i)
{
vct[n-]=i;
if(chk(vct,i))arr[i]=;
}
int res=;
for(int i=;i<;++i)
{
if(arr[i]&&arr[i+])++res;
}
cout<<res<<endl;
}
return ;
}

sgu 169 Numbers的更多相关文章

  1. SGU 169 numbers 数学

    169.Numbers Let us call P(n) - the product of all digits of number n (in decimal notation). For exam ...

  2. SGU 169 Numbers (找规律)

    题意:中文题,直接忽略... 析:先说说我的思路,我一看这个题第一感觉就是要找规律,要是挨着算,猴年马月都跑不完,更何况时间限制是0.25s,怎么找规律呢,我算了一下前10位,分别是8,1,1,3,1 ...

  3. SGU 分类

    http://acm.sgu.ru/problemset.php?contest=0&volume=1 101 Domino 欧拉路 102 Coprime 枚举/数学方法 103 Traff ...

  4. SGU 乱乱开

    本解题报告 乱抄,乱写,随性随心,不喜多喷! SGU 142: 思路:一个string的字串不会超过2^20个,我们枚举出来就好了. 我出错点:数组RE #include<stdio.h> ...

  5. 今日SGU 5.7

    SGU 169 题意:求k位数里面有多少个是完美数,完美数的定义就是n是好数,n+1也是好数,那么n就是完美数,好数就是n%p(n)==0&&p(n)!=0,p(n)=a1*...*a ...

  6. Nearly prime numbers - SGU 113(素数)

    题目大意:判断一个数是否是两个素数的乘积,如果是,输出Yes,否则No. 分析:先打表求出来一部分素因子,用素数对素数判定还是比较快的. 代码如下: ========================= ...

  7. SGU 113.Nearly prime numbers

    水一个代码: #include <iostream> using namespace std; int n, a; bool ok; bool prime (int x) { ; i * ...

  8. SGU 159.Self-Replicating Numbers

    时间限制:0.5s 空间限制:6M 题意:         在b(2<b<36)进制中,找到所有长度为n(0<n<2000)的自守数k,满足k^2%b^n=k,字典序输出.   ...

  9. SGU 258 Almost Lucky Numbers 接近幸运数(数位DP)

    题意: 定义一个具有2n位的正整数,其前n位之和与后n位之和相等,则为lucky数.给定一个区间,问有多少个正数可以通过修改某一位数从而变成lucky数?注意不能含前导0. 思路: 我的想法是记录那些 ...

随机推荐

  1. javaweb三大框架和MVC设计模式

    javaweb三大框架和MVC设计模式 转载,原文请见https://blog.csdn.net/sunpeng19960715/article/details/50890705 一.MVC设计模式 ...

  2. linux内核中的PTP clock是什么?

    答: Precise Time Protocol(PTP),这是一种高精度时间同步协议,PTP是在硬件级实现的,因此需要硬件支持才能实现高精度时间同步

  3. 【Spring Security】二、数据库管理用户权限

    一 引入相关的jar包 这个例子用的是mysql数据库和c3p0开源的jdbc连接池,在项目的pom.xml中引入jar包 <!-- Mysql --> <dependency> ...

  4. 论文笔记之:DualGAN: Unsupervised Dual Learning for Image-to-Image Translation

    DualGAN: Unsupervised Dual Learning for Image-to-Image Translation 2017-06-12  21:29:06   引言部分: 本文提出 ...

  5. ZOJ 3632 ----dp+优先队列

    上个礼拜学长讲了优先队列的说.... emmmmmm.... 看着题解敲了一题...先m下. #include<cstring> #include<algorithm> #in ...

  6. 洛谷P2637第一次,第二次,成交! 模拟?DP?

    今天水来一天,就贴道水吧.. 原题>>https://www.luogu.org/problem/show?pid=2637<< 题目描述 因为奶牛们的节食运动(奶牛还节食?) ...

  7. 给 layui upload 带每个文件的进度条, .net 后台代码

    1.upload.js 扩展 功能利用ajax的xhr属性实现该功能修改过modules中的upload.js文件功能具体实现:在js文件中添加监听函数 //创建监听函数 var xhrOnProgr ...

  8. 每日质量NPM包-classnames

    一.classnames 现在到处都追求效率开发,所谓存在即合理,各种各样的开源包/项目火热,也是因为他们大大解决了之前复杂的逻辑.作为榜上前10的热门包:classnames.还真需要了解了解它才能 ...

  9. 在使用Java8并行流时的问题分析

    最近在使用Java8的并行流时遇到了坑,线上排查问题时花了较多时间,分享出来与大家一起学习与自查 // 此处为坑 List<Java8Demo> copy = Lists.newArray ...

  10. 使用CSS渐变

    转载自:https://developer.mozilla.org/zh-CN/docs/Web/Guide/CSS/Using_CSS_gradients CSS 渐变 是在 CSS3 Image ...