简单题。

 #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. ios 字符串的操作汇总

    //将NSData转化为NSString        NSString* str = [[NSString alloc] initWithData:response encoding:NSUTF8S ...

  2. 硬盘图标修改器 V1.0 绿色版

    软件名称:硬盘图标修改器 V1.0 绿色版软件语言: 简体中文授权方式: 免费软件应用平台: Win7 / Vista / Win2003 / WinXP / Win2008 软件大小: 12.3MB ...

  3. spring配置文件详解【总结】

    知其然,知其所以然 <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns=&qu ...

  4. 借助nginx搭建反向代理服务器小例

    1 反向代理: 反向代理(Reverse Proxy)方式是指以代理服务器接收internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接 ...

  5. jquety选择器

    基本选择器 1.#id        根据id的属性值来获取元素 2.TagName     根据标签名来获取元素 3.selector1,selector2    匹配列表中的选择器(就是可以匹配多 ...

  6. iostextField文本框基本使用

    (1)可以根据需要设置文本框的样式(包括形状.边框颜色.背景等). (2)可以根据需要设置文字显示样式(包括输入密码时的密文显示.文字横向居中.纵向居中上下.输入的文字是否首席木大写.文字超过后是否缩 ...

  7. cmd命令行

    拷贝

  8. java中的静态变量

    大家都知道,我们可以基于一个类创建多个该类的对象,每个对象都拥有自己的成员,互相独立.然而在某些时候,我们更希望该类所有的对象共享同一个成员.此时就是 static 大显身手的时候了!! Java 中 ...

  9. [实用]DNS解析命令,静静地学会【转载】

    [实用]DNS解析命令,静静地学会 2016-08-04 06:50 一.Windows下的nslookup 简单的查某个域名,那就nslookup toutiao.com,上面是dns地址,下面是解 ...

  10. c++面试题【转】

    语言部分: 虚函数,多态.这个概念几乎是必问. STL的使用和背后数据结构,vector string map set 和hash_map,hash_set 实现一个栈类,类似STL中的栈.这个题目初 ...