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 ...
随机推荐
- 关于ARMv8另外几个问题
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/qianlong4526888/article/details/27510675 问题1:支持ARMv ...
- 多线程2.md
# 多线程 VS 多进程 - 程序:一堆代码以文本形式存入一个文档 - 进程: 程序运行的一个状态 - 包含地址空间.内存.数据栈等 - 每个进程由自己完全独立的运行环境,多进程共享数据是一个问题 ...
- 001-js-时间格式化
方法一. // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1 ...
- 控制input框只能粘贴,不能输入
.禁用文本框的onkeydown事件 <input type="text" onkeydown="return false"> .改造,可以使用ct ...
- Kinect2.0获取数据
最近事情真是多,今天抽空研究一下Kinec2.0的数据获取! 系统要求 https://developer.microsoft.com/en-us/windows/kinect/hardware-se ...
- [LeetCode] 610. Triangle Judgement_Easy tag: SQL
A pupil Tim gets homework to identify whether three line segments could possibly form a triangle. Ho ...
- node跨域cors模块,nodejs+express跨域
使用express写的接口,只能在内部使用,如果想要外部的服务访问,就涉及到了跨域.但是又不想用jsonp,其实有一个node模块,可以轻松实现跨域 npm install cors --save 然 ...
- bootstrap评分插件 Bootstrap Star Rating Examples
http://www.jq22.com/demo/bootstrap-star-rating-master201708041812/
- MySQL--3约束和修改数据表总结
- Lepus(天兔)监控MySQL部署
http://www.dbarun.com/docs/lepus/install/lnmp/ 注意:xampp mysqldb-python版本太高会导致lepus白屏 apache版本最好选择2.2 ...