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. SQL Server 安装好后 Always On群组配置

    需要对SQL Server必要的端口打开Windows防火墙的入站规则,比如TCP- 1433端口等. 特别注意:由于AG默认需要用到TCP-5022端口,所以该端口务必保证在Windows防火墙中开 ...

  2. 008-js中的正则表达式

    查看地址:http://www.runoob.com/js/js-regexp.html 一.正则表达式概述 正则表达式(英语:Regular Expression,在代码中常简写为regex.reg ...

  3. 清空select标签中option选项的3种不同方式

    方法一 代码如下:document.getElementById("selectid").options.length = 0; 方法二 代码如下:document.formNam ...

  4. sap component 导航 链接

    1: 定义一个导航链接名字,这个名子如果在程序中遇到(该名字会在程序中使用),就会触发这样一个导航. 导航有两个view,一个原来的view,一个出发abc之后的target view,也就是目标视图 ...

  5. HTTP协议(TCP/IP)

    HTTP协议(TCP/IP): 服务器套接字(TCP用主机的IP地址加上主机上的端口号作为TCP连接的端点,这种端点就叫做套接字(socket)或插口)   数据包(请求包.报文)http 请求格式: ...

  6. nodejs+mysql入门实例(删)

    //连接数据库 var mysql = require('mysql'); var connection = mysql.createConnection({ host: 'bdm253137448. ...

  7. JS--理解call、apply和bind

    call.apply和bind call,apply是Function原型中的方法,它们的作用一样,区别在于传入参数的方式不同. call(thisArg, arg1, arg2...) 传入的参数不 ...

  8. Kotlin 范型约束

    官方的示意及其简约,该说的一概没说 我在这里给大家一个完整的例子 //test.kt fun <T> cloneWhenGreater(list: List<T>, thres ...

  9. Mac下安装m2crypto 解决找不到openssl头文件的错误

    直接复制整段到终端运行 sudo env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --pref ...

  10. T Y P E L I B R A R I E S库加载

    #---------------------------------------------------------------------------- # T Y P E L I B R A R ...