Time limit : 2sec / Memory limit : 256MB
Score : 100 points
Problem Statement
There is a hotel with the following accommodation fee:
- X yen (the currency of Japan) per night, for the first K nights
- Y yen per night, for the (K+1)-th and subsequent nights
Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee.
Constraints
- 1≤N,K≤10000
- 1≤Y<X≤10000
- N, K, X, Y are integers.
Input
The input is given from Standard Input in the following format:
N
K
X
Y
Output
Print Tak's total accommodation fee.
Sample Input 1
5
3
10000
9000
Sample Output 1
48000
The accommodation fee is as follows:
- 10000 yen for the 1-st night
- 10000 yen for the 2-nd night
- 10000 yen for the 3-rd night
- 9000 yen for the 4-th night
- 9000 yen for the 5-th night
Thus, the total is 48000 yen.
Sample Input 2
2
3
10000
9000
Sample Output 2
20000 题解:水过
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
{
return x>y;
}
const int N=;
const int mod=1e9+;
int main()
{
std::ios::sync_with_stdio(false);
int n,k,x,y;
cin>>n>>k>>x>>y;
ll s=;
if(n<=k) s+=n*x;
else s+=k*x+(n-k)*y;
cout<<s<<endl;
return ;
}
AtCoder Beginner Contest 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)的更多相关文章
-
AtCoder Beginner Contest 044 C - 高橋君とカード / Tak and Cards
题目链接:http://abc044.contest.atcoder.jp/tasks/arc060_a Time limit : 2sec / Memory limit : 256MB Score ...
-
高橋君とホテル / Tak and Hotels
高橋君とホテル / Tak and Hotels Time limit : 3sec / Stack limit : 256MB / Memory limit : 256MB Score : 700 ...
-
AtCoder Beginner Contest 045 B - 3人でカードゲームイージー / Card Game for Three (ABC Edit)
Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement Alice, Bob and Charlie ...
-
高橋君とカード / Tak and Cards
高橋君とカード / Tak and Cards Time limit : 2sec / Stack limit : 256MB / Memory limit : 256MB Score : 300 p ...
-
高橋君とカード / Tak and Cards AtCoder - 2037 (DP)
Problem Statement Tak has N cards. On the i-th (1≤i≤N) card is written an integer xi. He is selectin ...
-
AtCoder Beginner Contest 044 B - 美しい文字列 / Beautiful Strings
Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement Let w be a string cons ...
-
AtCoder Beginner Contest 022 A.Best Body 水题
Best Body Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://abc022.contest.atcoder.jp/tasks/abc02 ...
-
AtCoder Beginner Contest 177 题解
AtCoder Beginner Contest 177 题解 目录 AtCoder Beginner Contest 177 题解 A - Don't be late B - Substring C ...
-
AtCoder Beginner Contest 173 题解
AtCoder Beginner Contest 173 题解 目录 AtCoder Beginner Contest 173 题解 A - Payment B - Judge Status Summ ...
随机推荐
-
maven 打war包tomcat服务器乱码问题
今天用maven3的命令打war包,命令是mvn clean package -Dmaven.test.skip=true,打包后放在tomcat跑起来后发现tomcat的日志出现乱码. 后来在pom ...
-
织梦cms、帝国cms、PHPcms优缺点解析
php才是建站的主流,cms这类程序又是用的最多的,占据主流的cms主要就是织梦,帝国,phpcms这三种的,这三个程序都是开源程序.国内用户众多. 一.从美观性来说(以官方默认模版为准 ph ...
-
java jps 命令详解
JPS 名称: jps - Java Virtual Machine Process Status Tool 命令用法: jps [options] [hostid] options:命令选项,用来对 ...
-
android listview 的监听事件
今天遇到了一个比较让我头疼的问题,不过追根揭底只是我对listview理解的不够透彻罢了, 闲言少叙,说说我遇到的问题吧: 上篇随笔我写了关于listview的使用,如果你也已经写好了列表那么恭喜这一 ...
-
hiho_1079_离散化
题目 在长度为L的宣传栏上张贴N张海报,将宣传栏分为L个长度为1的单位,海报长度为整数,且高度和宣传栏相同,左右边界和宣传栏单位之间缝隙重合(即海报总是跨越整数个单位).后贴的海报可能会覆盖之前贴的海 ...
-
html 模板
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
-
浅析a标签的4个伪类 .
关于伪类,大家最熟悉的还是a标签的4个伪类::link 有链接属性时:visited 链接地址已被访问过:active 被用户激活(在鼠标点击与释放之间发生的事件):hov ...
-
【2017-05-02】winform弹出警告框是否进行增删改操作、记事本制作、对话框控件和输出输入流
一.winform弹出警告框是否进行增删改操作 第一个参数是弹出窗体显示的内容,第二个参数是标题,第三个参数是该弹窗包含确定和取消按钮. 返回的是一个枚举类接收一下. 再进行判断,如果点的是确定按钮, ...
-
spring boot 启动错误:Could not resolve placeholder
在启动整个spring boot项目时,出现错误: Could not resolve placeholder 原因:没有指定好配置文件,因为src/main/resources下有多个配置文件,例如 ...
-
spring mvc activemq
http://websystique.com/spring/spring-4-jms-activemq-example-with-jmslistener-enablejms/