链接:

https://www.nowcoder.com/acm/contest/143/J

#include<bits/stdc++.h>
using namespace std;
long long n, p2, p3;
int main(){
cin >> n >> p2 >> p3;
double c2 = p2 / 2.0, c3 = p3 / 3.0; if(n == ) cout << (long long)(p2 < p3 ? p2 : p3) << "\n"; else if(c2 <= c3){
if(n % == ){
cout << n / * p2 << "\n";
}else{
long long temp = p3 - p2;
temp = temp < p2 ? temp : p2;
cout << n / * p2 + temp << "\n";
}
}else {
if(n% == ){
cout << n / * p3 << "\n";
}else if(n % == ){
long long temp = p2;
temp = temp < p3 ? temp : p3;
temp = temp < * p2 - p3 ? temp : * p2 - p3; cout << n/ * p3 + temp << "\n";
}else if(n % == ){
long long temp = p2; temp = temp < p3 ? temp : p3; cout << n/ * p3 + temp << "\n";
}
}
return ;
}

牛客网暑期ACM多校训练营(第四场) J 贪心的更多相关文章

  1. 牛客网暑期ACM多校训练营(第二场)J farm (二维树状数组)

    题目链接: https://www.nowcoder.com/acm/contest/140/J 思路: 都写在代码注释里了,非常好懂.. for_each函数可以去看一下,遍历起vector数组比较 ...

  2. 牛客网 暑期ACM多校训练营(第二场)A.run-动态规划 or 递推?

    牛客网暑期ACM多校训练营(第二场) 水博客. A.run 题意就是一个人一秒可以走1步或者跑K步,不能连续跑2秒,他从0开始移动,移动到[L,R]的某一点就可以结束.问一共有多少种移动的方式. 个人 ...

  3. 牛客网 暑期ACM多校训练营(第一场)A.Monotonic Matrix-矩阵转化为格子路径的非降路径计数,Lindström-Gessel-Viennot引理-组合数学

    牛客网暑期ACM多校训练营(第一场) A.Monotonic Matrix 这个题就是给你一个n*m的矩阵,往里面填{0,1,2}这三种数,要求是Ai,j⩽Ai+1,j,Ai,j⩽Ai,j+1 ,问你 ...

  4. 2018牛客网暑期ACM多校训练营(第二场)I- car ( 思维)

    2018牛客网暑期ACM多校训练营(第二场)I- car 链接:https://ac.nowcoder.com/acm/contest/140/I来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 ...

  5. 牛客网暑期ACM多校训练营(第一场) - J Different Integers(线段数组or莫队)

    链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048 ...

  6. 牛客网暑期ACM多校训练营(第九场) A题 FWT

    链接:https://www.nowcoder.com/acm/contest/147/A来源:牛客网 Niuniu has recently learned how to use Gaussian ...

  7. 牛客网暑期ACM多校训练营(第九场)D

    链接:https://www.nowcoder.com/acm/contest/147/D来源:牛客网 Niuniu likes traveling. Now he will travel on a ...

  8. 牛客网暑期ACM多校训练营(第二场)B discount

    链接:https://www.nowcoder.com/acm/contest/140/B来源:牛客网 题目描述 White Rabbit wants to buy some drinks from ...

  9. 2018牛客网暑期ACM多校训练营(第一场)D图同构,J

    链接:https://www.nowcoder.com/acm/contest/139/D来源:牛客网 同构图:假设G=(V,E)和G1=(V1,E1)是两个图,如果存在一个双射m:V→V1,使得对所 ...

  10. 牛客网暑期ACM多校训练营(第二场) I Car 思维

    链接:https://www.nowcoder.com/acm/contest/140/I来源:牛客网 White Cloud has a square of n*n from (1,1) to (n ...

随机推荐

  1. spring 通配符

    原文地址:http://www.bubuko.com/infodetail-848675.html classpath是指 WEB-INF文件夹下的classes目录(惯例大于配置) classpat ...

  2. Codeforces Round #261 (Div. 2) D

    Description Parmida is a clever girl and she wants to participate in Olympiads this year. Of course ...

  3. Milking Grid POJ - 2185 || 最小覆盖子串

    Milking Grid POJ - 2185 最小覆盖子串: 最小覆盖子串(串尾多一小段时,用前缀覆盖)长度为n-next[n](n-pre[n]),n为串长. 当n%(n-next[n])==0时 ...

  4. URAL 7077 Little Zu Chongzhi's Triangles(14广州I)

    题目传送门 题意:有n根木棍,三根可能能够构成三角形,选出最多的三角形,问最大面积 分析:看到这个数据范围应该想到状压DP,这次我想到了.0010101的状态中,1表示第i根木棍选择,0表示没选,每一 ...

  5. magento package

    Magento Local module file is relative to app/code/local/ Magento Community module file is relative t ...

  6. Harris角点检测原理及实现

    一.原理 二.实现 close all; clear all; I=imread('test.tif'); [posX,posY]=harris(I); figure;imshow(I); hold ...

  7. Zernike矩之图像重建(附源码)

    源码下载 参考: [1] Teague M R. Image analysis via the general theory of moments[J]. JOSA, 1980, 70(8): 920 ...

  8. python中函数参数

    默认参数注意点 优点:灵活,当没有指定与形参对应的实参时就会使用默认参数 缺陷: 例子: >>> def h(m, l=[]):                    #默认参数时列 ...

  9. qconbeijing2017

    http://2017.qconbeijing.com/schedule 第一天 (2017年4月16日/星期日)   签到 专题 主题演讲 快速进化的容器生态 微服务与 DevOps 最佳实践(厂商 ...

  10. Mysql多表联合更新、删除

    UPDATE snyts_user u INNER JOIN snyts_order o ON u.user_id = o.user_id INNER JOIN snyts_refund_order ...