简单题。

 #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<stack>
using namespace std; long long n,a,b,p,q; long long gcd(long long a,long long b)
{
if(b==) return a;
return gcd(b,a%b);
} int main()
{
scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&p,&q); long long num1,num2,num3;
num1=n/a;
num2=n/b;
long long GCD=gcd(a,b);
long long LCM=a*b/GCD;
num3=n/LCM; long long ans=(num1-num3)*p+(num2-num3)*q+num3*max(p,q);
printf("%lld\n",ans); return ;
}

CodeForces 678C Joty and Chocolate的更多相关文章

  1. codeforces 678C. Joty and Chocolate(容斥) 2016-10-15 21:49 122人阅读 评论(0) 收藏

    C. Joty and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standar ...

  2. codeforces 678C C. Joty and Chocolate(水题)

    题目链接: C. Joty and Chocolate time limit per test 1 second memory limit per test 256 megabytes input s ...

  3. Educational Codeforces Round 13 C. Joty and Chocolate 水题

    C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...

  4. Educational Codeforces Round 1 E. Chocolate Bar 记忆化搜索

    E. Chocolate Bar Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/prob ...

  5. Educational Codeforces Round 1 E. Chocolate Bar dp

    题目链接:http://codeforces.com/contest/598/problem/E E. Chocolate Bar time limit per test 2 seconds memo ...

  6. Codeforces 689C. Mike and Chocolate Thieves 二分

    C. Mike and Chocolate Thieves time limit per test:2 seconds memory limit per test:256 megabytes inpu ...

  7. codeforces 450C. Jzzhu and Chocolate 解题报告(449A)

    题目链接:http://codeforces.com/contest/450/problem/C 题目意思:给出一个 n * m 大小的chocolate bar,你需要在这个bar上切 k 刀,使得 ...

  8. CodeForces 689C Mike and Chocolate Thieves (二分+数论)

    Mike and Chocolate Thieves 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/G Description ...

  9. codeforces C. Jzzhu and Chocolate

    http://codeforces.com/contest/450/problem/C 题意:一个n×m的矩形,然后可以通过横着切竖着切,求切完k次之后最小矩形面积的最大值. 思路:设k1为横着切的次 ...

随机推荐

  1. wpf 异步加载 只需6段代码

    private BackgroundWorker worker = null; ProgressBar probar = new ProgressBar(); private int percentV ...

  2. python-连接数据库

    from sqlalchemy import create_engine,text,Column,Integer,String,Sequencefrom sqlalchemy.ext.declarat ...

  3. iOS 加载本地的html文件

    方法1: self.webView  = [[UIWebView alloc]initWithFrame:self.view.bounds]; NSString *path = [[NSBundle ...

  4. 从0开始学习blockchain

    http://www.8btc.com/build-your-own-blockchain

  5. CSSHack 兼容性

    史上最全的CSS hack方式一览    CSS hack技巧大全    Can i use CSS hack CSS hack 由于不同厂商的流览器或某浏览器的不同版本(如IE6-IE11,Fire ...

  6. BaLaBaLa

    #include<cstdio>#include<cstring>#include<cmath>#include<queue>#include<a ...

  7. C语言_数字排列顺序

    #include <stdio.h> #include <stdlib.h> #define LENGTH 8 void main() { , , , , , , , }; ; ...

  8. hdu_3067_小t的游戏(脑洞)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3067 题意:中文,不解释 题解:一看就知道是要找规律的题,都是有循环节的,看代码. #include ...

  9. cmstop中实例化controller_admin_content类传递$this,其构造方法中接收到的是--名为cmstop的参数--包含cmstop中所有属性

    主程序cmstop类,实例化controller_admin_content类(接收请求后拼接的).传递cmstop所有属性过去.controller_admin_content.构造方法中接收到名称 ...

  10. servlet第2讲(下集)----创建servlet实例(继承HttpServlet)