L Berland University

There are t students studying in the best university of Berland. They only study programming in Berland, so there is only one subject. Each student must attend the lectures.

The entire course consists of n lectures. It is known that a student who visits at least k of them will pass the course.

There are only two auditoriums in the university, one has space for a people and the other one — for b people. To make it comfortable, the administration decided that in odd weeks the lectures will be in the first auditorium, and in the even weeks — in the second auditorium. So the first lecture will be in the 1-st auditorium, the second lecture in the 2-nd one, the third in the 1-st one again, and so on.

The sizes of the auditoriums are small so it might not be possible for all students to attend at least k lectures. They ask you to count the maximum number of students that can pass the course.

Input

The first line contains five integers:

t — the number of students;

n — the number of lectures;

a — the size of the first auditorium;

b — the size of the second auditorium;

k — the minimal number of lectures to pass the course.

The limits are: 1 ≤ t, n, a, b, k ≤ 109 .

Output

Print a single integer — the maximal number of students that can attend at least k lectures and thus pass the course.

#include <bits/stdc++.h>
#define INF 0x3fffffff
#define ll long long
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl;
using namespace std;
ll t,n,a,b,k,ans,s;
int main(){
    cin >> t >> n >> a >> b >> k;
	ll low=0,high=t;
	while(low<high){//二分答案
		ll mid = (low+high+1)/2;
		ll x=min(a,mid), y=min(mid,b);
		ll yy,xx;
		if(n&1)
        yy = n/2, xx = n/2+1;
        else
            yy = n/2, xx = n/2;
		if((x*xx+y*yy)>=k*mid)//k*mid是上课总数,,,x*xx+y*yy是总课数
            low=mid;
		else
            high=mid-1;
	}
	cout << low << endl;
    return 0;
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CONTENTS 1 MATHEMATICAL PRELIMINARIES 1.1 Invariants 1 1.2 Some geometrical invariants 2 1.3 Elements of differential geometry 5 1.4 Gaussian coordinates and the invariant line element 7 1.5 Geometry and groups 10 1.6 Vectors 13 1.7 Quaternions 13 1.8 3-vector analysis 16 1.9 Linear algebra and n-vectors 18 1.10 The geometry of vectors 21 1.11 Linear operators and matrices 24 1.12 Rotation operators 25 1.13 Components of a vector under coordinate rotations 27 2 KINEMATICS: THE GEOMETRY OF MOTION 2.1 Velocity and acceleration 33 2.2 Differential equations of kinematics 36 2.3 Velocity in Cartesian and polar coordinates 39 2.4 Acceleration in Cartesian and polar coordinates 41 3 CLASSICAL AND SPECIAL RELATIVITY 3.1 The Galilean transformation 46 3.2 Einstein’s space-time symmetry: the Lorentz transformation 48 3.3 The invariant interval: contravariant and covariant vectors 51 3.4 The group structure of Lorentz transformations 53 3.5 The rotation group 56 3.6 The relativity of simultaneity: time dilation and length contraction 57 3.7 The 4-velocity 61 4 NEWTONIAN DYNAMICS 4.1 The law of inertia 65 4.2 Newton’s laws of motion 67 4.3 Systems of many interacting particles: conservation of linear and angular vii momentum 68 4.4 Work and energy in Newtonian dynamics 74 4.5 Potential energy 76 4.6 Particle interactions 79 4.7 The motion of rigid bodies 84 4.8 Angular velocity and the instantaneous center of rotation 86 4.9 An application of the Newtonian method 88 5 INVARIANCE PRINCIPLES AND CONSERVATION LAWS 5.1 Invariance of the potential under translations and the conservation of linear momentum 94 5.2 Invariance of the potential under rotations and the conservation of angular momentum 94 6 EINSTEINIAN DYNAMICS 6.1 4-momentum and the energy-momentum invariant 97 6.2 The relativistic Doppler shift 98 6.3 Relativistic collisions and the conservation of 4- momentum 99 6.4 Relativistic inelastic collisions 102 6.5 The Mandelstam variables 103 6.6 Positron-electron annihilation-in-flight 106 7 NEWTONIAN GRAVITATION 7.1 Properties of motion along curved paths in the plane 111 7.2 An overview of Newtonian gravitation 113 7.3 Gravitation: an example of a central force 118 7.4 Motion under a central force and the conservation of angular momentum 120 7.5 Kepler’s 2nd law explained 120 7.6 Central orbits 121 7.7 Bound and unbound orbits 126 7.8 The concept of the gravitational field 128 7.9 The gravitational potential 131 8 EINSTEINIAN GRAVITATION: AN INTRODUCTION TO GENERAL RELATIVITY 8.1 The principle of equivalence 136 8.2 Time and length changes in a gravitational field 138 8.3 The Schwarzschild line element 138 8.4 The metric in the presence of matter 141 8.5 The weak field approximation 142 viii 8.6 The refractive index of space-time in the presence of mass 143 8.7 The deflection of light grazing the sun 144 9 AN INTRODUCTION TO THE CALCULUS OF VARIATIONS 9.1 The Euler equation 149 9.2 The Lagrange equations 151 9.3 The Hamilton equations 153 10 CONSERVATION LAWS, AGAIN 10.1 The conservation of mechanical energy 158 10.2 The conservation of linear and angular momentum 158 11 CHAOS 11.1 The general motion of a damped, driven pendulum 161 11.2 The numerical solution of differential equations 163 12 WAVE MOTION 12.1 The basic form of a wave 167 12.2 The general wave equation 170 12.3 The Lorentz invariant phase of a wave and the relativistic Doppler shift 171 12.4 Plane harmonic waves 173 12.5 Spherical waves 174 12.6 The superposition of harmonic waves 176 12.7 Standing waves 177 13 ORTHOGONAL FUNCTIONS AND FOURIER SERIES 13.1 Definitions 179 13.2 Some trigonometric identities and their Fourier series 180 13.3 Determination of the Fourier coefficients of a function 182 13.4 The Fourier series of a periodic saw-tooth waveform 183 APPENDIX A SOLVING ORDINARY DIFFERENTIAL EQUATIONS 187 BIBLIOGRAPHY 198
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值