595B - Pasha and Phone

代码:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=1e5+;
const int INF=0x3f3f3f3f;
const int MOD=1e9+;
ll a[N];
int b[N];
int dp[]={};
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n,k;
cin>>n>>k;
for(int i=;i<n/k;i++)cin>>a[i];
for(int i=;i<n/k;i++)cin>>b[i];
for(int i=;i<=k;i++)dp[i]=dp[i-]*; ll ans=;
for(int i=;i<n/k;i++)
{
int t=;
ll n1=(dp[k]-)/a[i]+;//a[i]倍数的数量
ll n2=(dp[k-]-)/a[i]+;//最高位为0的a[i]倍数的数量
ll n3=(dp[k-]*(b[i]+)-)/a[i]-(dp[k-]*b[i]-)/a[i];//最高位为b[i]的a[i]的倍数的数量
if(b[i]==)ans*=n1-n2;
else ans*=n1-n3;
ans%=MOD;
}
cout<<ans<<endl;
return ;
}

Codeforces 595B - Pasha and Phone的更多相关文章

  1. Codeforces 595B. Pasha and Phone 容斥

    B. Pasha and Phone time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  2. codeforces 557B. Pasha and Tea 解题报告

    题目链接:http://codeforces.com/problemset/problem/557/B 题目意思:有 2n 个茶杯,规定第 i 个茶杯最多只能装 ai 毫升的水.现在给出 w 毫升的水 ...

  3. CodeForces 595B

    题目链接: http://codeforces.com/problemset/problem/595/B 题意: 有一个n位的电话号码,每位电话号码将分成n/k段,每段均为k个数,求出满足以下要求的电 ...

  4. Codeforces 435B. Pasha Maximizes

    简单贪心.... B. Pasha Maximizes time limit per test 1 second memory limit per test 256 megabytes input s ...

  5. codeforces B. Pasha and String

    Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters ...

  6. codeforces B. Pasha and String(贪心)

    题意:给定一个长度为len的字符序列,然后是n个整数,对于每一个整数ai, 将字符序列区间为[ai,len-ai+1]进行反转.求出经过n次反转之后的序列! /* 思路1:将区间为偶数次的直接去掉!对 ...

  7. [ An Ac a Day ^_^ ] CodeForces 525B Pasha and String 技巧

    题意就是一次次翻转字符串 然后输出最终的字符串 暴力一发O(n*m)果然超时了 因为每次翻转的的都是a-1到对称位置 所以一个位置翻转两次等于没有操作 所以只需要记录一下len/2的位置前的操作次数 ...

  8. CodeForces 610A Pasha and Stick

    #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using ...

  9. Codeforces Round #249 (Div. 2)B(贪心法)

    B. Pasha Maximizes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

随机推荐

  1. swoole线程和进程

    pstree -a | grep php |   |       `-php server.php   主进程      |   |           |-php server.php   管理线程 ...

  2. 003-ubuntu上安装mysql

    安装如下: 1.安装服务端:# sudo apt-get  install mysql-server. 2.安装客户端:# sudo apt-get -y install mysql-server. ...

  3. EditPlus 4.3.2502 中文版已经发布(12月5日更新)

    新的版本修复了在之前某版本中键盘 End 键定位位置错误的问题.

  4. Azkaban 简介

    本文简单介绍一下Azkaban及其特点.azkaban是一个开源的任务调度系统,用于负责任务的调度运行(如数据仓库调度),用以替代linux中的crontab. 一.Azkaban是什么? 1.1 A ...

  5. 使用 JsPlumb 绘制拓扑图的通用方法

    摘要: 实现 JsPlumb 绘制拓扑图的通用方法. 只要服务端返回一个符合指定格式的数据结构,就可以绘制相应的拓扑图. 难度: 中级 示例工程见:  http://download.csdn.net ...

  6. 2018-2019-2 20165209 《网络对抗技术》Exp2:后门原理与实践

    2018-2019-2 20165209 <网络对抗技术>Exp2:后门原理与实践 1 后门原理与实验内容 1.1 后门原理 -后门就是不经过正常认证流程而访问系统的通道. 哪里有后门呢? ...

  7. linux服务器---squid限制

    Squid连接限制 Squid可以有效的限制连接,指定哪些用户可以连接,指定哪些网站可以访问,这样就可以有效的利用服务器带宽. 1.限制指定网段不能连接.编辑配置文件”/etc/squid/squid ...

  8. Python3.x(windows系统)安装libxml2库

    Python3.x(windows系统)安装libxml2库 cmd安装命令: pip install lxml 执行结果: 再执行命令: pip install virtualenv 执行结果:

  9. 怎么说, 开发会很乐意去主动修改bug?

    怎么说, 开发会很乐意去主动修改bug? 一图顶上千言万语,如下:

  10. 安装Qt5.9

    目前,作为一个重量级编程开发工具,Qt 已经正式发布了 5.9.0 版本.相比之前的 5.7,5.8 版本,新版本在性能和功能上有了大幅改善和提高,并由此获得了官方的明确表态:这将是继 5.6 之后的 ...