题意: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. "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to ma

    Centos7.5 ansible第一次使用模块报错 问题: [root@m01 ~]# ansible webservers -m ping -i ./hosts 172.16.1.7 | FAIL ...

  2. Python3基础 list count 查询指定元素在列表中出现了多少次

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  3. What are the differences between Flyweight and Object Pool patterns?

    What are the differences between Flyweight and Object Pool patterns? They differ in the way they are ...

  4. Selenium Webdriver 自动化测试开发常见问题(C#版)

    转一篇文章,有修改,出处http://www.7dtest.com/site/blog-2880-203.html 1:Selenium中对浏览器的操作 首先生成一个Web对象 IWebDriver ...

  5. 软件开发架构、网络基础知识、osi七层模型

    一.软件开发的架构 涉及到两个程序之间通讯的应用大致可以分为两种: 第一种是应用类:qq.微信.网盘.优酷这一类是属于需要安装的桌面应用 第二种是web类:比如百度.知乎.博客园等使用浏览器访问就可以 ...

  6. RN酷炫组件圆形加载

    地址:https://js.coach/react-native/react-native-circular-progress?search=react-native 别谢我 点个赞就行 ## Use ...

  7. _map

    地图属性控制表 comment 备注 Map 地图ID,.gps第一个参数 Zone 区域ID,.gps第二个参数,整个地图时填0 Area 地域ID,.gps第三个参数,整个地图或区域时填0 Cha ...

  8. VirtualBox--虚拟机网络设置1--(四种方式)

    转载自:https://www.douban.com/group/topic/15558388/ VirtualBox的提供了四种网络接入模式,它们分别是: 1.NAT 网络地址转换模式(NAT,Ne ...

  9. git difftool和mergetool图形化

    1.当然是先安装Beyond Compare3 (此处省略安装步骤,自行百度) 2.设置difftool git config --global diff.tool bc3 git config -- ...

  10. [原][源码][tinyxml][opencv]按照规格剪切所有的图片

    源码: #include <iostream> #include <fstream> #include <opencv2/core/core.hpp> #inclu ...