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

Copy
5
3
10000
9000

Sample Output 1

Copy
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

Copy
2
3
10000
9000

Sample Output 2

Copy
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)的更多相关文章

  1. AtCoder Beginner Contest 044 C - 高橋君とカード / Tak and Cards

    题目链接:http://abc044.contest.atcoder.jp/tasks/arc060_a Time limit : 2sec / Memory limit : 256MB Score ...

  2. 高橋君とホテル / Tak and Hotels

    高橋君とホテル / Tak and Hotels Time limit : 3sec / Stack limit : 256MB / Memory limit : 256MB Score : 700  ...

  3. 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 ...

  4. 高橋君とカード / Tak and Cards

    高橋君とカード / Tak and Cards Time limit : 2sec / Stack limit : 256MB / Memory limit : 256MB Score : 300 p ...

  5. 高橋君とカード / 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 ...

  6. AtCoder Beginner Contest 044 B - 美しい文字列 / Beautiful Strings

    Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement Let w be a string cons ...

  7. AtCoder Beginner Contest 022 A.Best Body 水题

    Best Body Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://abc022.contest.atcoder.jp/tasks/abc02 ...

  8. AtCoder Beginner Contest 177 题解

    AtCoder Beginner Contest 177 题解 目录 AtCoder Beginner Contest 177 题解 A - Don't be late B - Substring C ...

  9. AtCoder Beginner Contest 173 题解

    AtCoder Beginner Contest 173 题解 目录 AtCoder Beginner Contest 173 题解 A - Payment B - Judge Status Summ ...

随机推荐

  1. The Swift Programming Language 中文版

    http://numbbbbb.github.io/the-swift-programming-language-in-chinese/

  2. LVS集群简介及使用

    什么是集群 一组通过高速网络互联的计算组,并以单一系统的模式加以管理 将很多服务器集中在一起,提供一种服务,在客户端看来就象是只有一个服务器 可以在付出较低成本的情况下获得在性能,可靠性,灵活性方面的 ...

  3. C# HtmlElement的GetAttribute("class") return ""

    用GetAttribute("className")代替GetAttribute("class")

  4. PHP中parent、this、self和static的区别

    参考: http://www.cnblogs.com/devcjq/articles/2424738.html http://www.cnblogs.com/alsf/p/9621002.html h ...

  5. 调用另一个文件的python代码【转载】

    转自:https://blog.csdn.net/u010412719/article/details/47089883 例如我们有a.py和b.py两个文件,当我们需要在b.py文件中应用a.py中 ...

  6. 新手详解JAVA+数据库+JSP完成简单页面

    本篇以数据库添加为例(本例中数据库名为“xinxi”表单名字为“stud”) 准备---实体层: package entity; public class Student { private Stri ...

  7. Charles 使用教程

    Charles 的简介 如何安装 Charles 将 Charles 设置成系统代理 Charles 主界面介绍 过滤网络请求 截取 iPhone 上的网络封包 截取 Https 通讯信息 模拟慢速网 ...

  8. 使用VS2013自带的PreEmptive Dotfuscator and Analytis来混淆C#代码

    1. 使用VS2013编译你要打包的程序,会在文件夹中的 ..\bin\Release中 2. 点击VS2013中的TOOLS -> PreEmptive Dotfuscator and Ana ...

  9. 1021 Deepest Root

    这道题的关键在于如何求两个最远的结点,二叉树比较容易一直DFS就能找到,但是普通树就比较麻烦.要先找到一端,再去找另外一端,两端的并集就是答案.因为结点都是对称的,所以两端都是答案.还要注意去重,12 ...

  10. 一个vue的循环列表,里面的按钮的移入事件

    需求:移入的时候,互相关注变成取消关注 移入移出事件传参$event,把这个参数打印出来看就可以搞定,而不是移入的时候,文本都改变,只改变当前行 的文本 <p @mouseover=" ...