AtCoder Beginner Contest 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
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 ...
随机推荐
- url映射
#include<iostream> #include<algorithm> #include<ctype.h> #include<string> #i ...
- wx:Textctrl
import wx class Mywin(wx.Frame): def __init__(self, parent, title): super(Mywin, self).__init__(pare ...
- Java创建文件夹
import java.io.File; public class Mkdirs { public static void main(String[] args) { /** *创建文件夹,如果路径不 ...
- 全连接与softmax[转载]
转自:https://www.jianshu.com/p/88bb976ccbd9 1.全连接示例: 2.softmax softmax输入层应和输出层(输出维度与类别数一致)纬度一样,如果不一样,就 ...
- mybatis test条件判断 如何引用 传入的 list参数中的map中的值
<select id="query" resultType="map"> select * from ${tbName} <where> ...
- composer install 遭遇404错误
[Composer\Downloader\TransportException] The "https://packagist.phpcomposer.com/p/provider-2019 ...
- golang 获取get参数
package main import ( "log" "net/http" ) func main() { http.HandleFunc("/&q ...
- js树形结构-----(BST)二叉树增删查
function BinarySearchTree(){ var cnodes = function(key){ this.key = key; this.left = null; this.righ ...
- async await的用法
const fs = require('fs'); const readFile = function (fileName) { return new Promise(function (resolv ...
- java json Gson
引入 Gson 到 pom.xml <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> <de ...