D - Joty and Chocolate
来源:互联网 发布:手机点烟软件 编辑:程序博客网 时间:2024/05/21 09:09
#include<stdio.h>#include<algorithm>using namespace std;#define ll long longll gcd(ll a,ll b){ ll c; while(b) { c=a%b; a=b; b=c; } return a;}ll lcm(ll a,ll b){ return a*b/gcd(a,b);}int main(){ ll n,a,b,p,q,ans; scanf("%I64d%I64d%I64d%I64d%I64d",&n,&a,&b,&p,&q); ll aa=n/a; ll bb=n/b; ll cc=n/lcm(a,b); aa-=cc; bb-=cc; ans=aa*p+bb*q+cc*max(p,q); printf("%I64d\n",ans); return 0;}
0 0
- D - Joty and Chocolate
- Joty and Chocolate
- Joty and Chocolate
- Codeforces 678 C. Joty and Chocolate
- Codeforces-678C-Joty and Chocolate
- codeforces 678C Joty and Chocolate
- Codeforces 678C Joty and Chocolate
- Educational Codeforces Round 13 C Joty and Chocolate(数学)
- codeforces 678C. Joty and Chocolate(容斥)
- codeforces-678-C. Joty and Chocolate(数学)
- CodeForces 490D Chocolate
- codeforces 490 D Chocolate
- D(1909)Perfect Chocolate
- Alice, Bob and Chocolate
- Codeforces Jzzhu and Chocolate
- cf450C. Jzzhu and Chocolate
- Mike and Chocolate Thieves
- Alice, Bob and Chocolate
- 关于 shell 脚本中 重定向文件名带问号的解决办法
- 错误: Unable to find explicit activity class ...have you declared this activity in your AndroidMa
- Windows平板装Android双系统及建立UEFI引导全攻略(windows8.1+android6+phoenix)
- 基于 flask 框架的模拟instagram 图片分享网站的开发 2
- 关于微信的第三方登录
- D - Joty and Chocolate
- Vue.js学习 Item5 -- 计算属性computed与$watch
- 如何使用canvas画连续的线段
- JavaScript基础——强大的数组
- E - Pyramid of Glasses
- Java输入输出流 结构详解
- 欢迎使用CSDN-markdown编辑器
- Java 利用 ICC 色彩空间 color space profile 实现 RGB 和 CMYK 颜色的相互转换
- eclipse自动补全