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. Windows下Ionic Android开发环境搭建

    转自 http://www.itwap.net/ArticleContent.aspx?id=26 来源: itwap.net 作者: 词略 时间: 2015-4-2 16:57:28 (一)Ioni ...

  2. windows系统和进程内存基础知识

  3. JS函数调用的四种方法

    js的函数调用会免费奉送两个而外的参数就是 this 和 arguments .arguments是参数组,他并不是一个真实的数组,但是可以使用.length方法获得长度. 书上有说4中调用方式: 方 ...

  4. linux服务器上nginx日志访问量统计命令

    linux服务器上nginx日志访问量统计命令 日志文件所在地方:/var/log/nginx/access_iqueendress.com.log/var/log/nginx/access_m.iq ...

  5. bootstrap实战教程

    bootstrap实战教程 bootstrap介绍 简介 Bootstrap 是最受欢迎的 HTML.CSS 和 JS 框架,用于开发响应式布局.移动设备优先的 WEB 项目.全球数以百万计的网站都是 ...

  6. addEventListener的click和onclick的区别

    前两节都和addEventListener的click有关,于是在想它与onclick有什么区别呢,自己调试了一下,网上也有相关资料 事件绑定 onclick绑定方式 优点: - 简洁 - 处理事件的 ...

  7. Struts2快速后台验证 使用

    为了和前台基于JavaScript的开源验证框架RapidValidation使用统一的验证规则, 最大限度的减少重复的后台验证代码, 使用方式简便, 扩展方便. https://blog.csdn. ...

  8. web前端----Bootstrap框架

    Bootstrap介绍 Bootstrap是Twitter开源的基于HTML.CSS.JavaScript的前端框架. 它是为实现快速开发Web应用程序而设计的一套前端工具包. 它支持响应式布局,并且 ...

  9. MySQL Crash Course #03# Chapter 5. 6 排序. BETWEEN. IS NULL

    索引 排序检索的数据 SQL 过滤 vs. 应用程序过滤 简单 Where 补充:大小写敏感. BETWEEN. IS NULL Sorting Retrieved Data mysql> SE ...

  10. npm 查看全局安装过的包

    查看全局安装的包 npm list -g --depth 0 非全局安装的包 npm list --depth 0 如果不加参数 --depth 0会显示安装的包以及相关的依赖包,会显示的很详细.