Assignments---(贪心)
Assignments
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2038 Accepted Submission(s): 1013
4 2
3 5
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn =1e3+;
int a[maxn],b[maxn];
bool cmp(const int a,const int b){
return a>b;
}
int main(){
int n,t;
while(~scanf("%d%d",&n,&t)){
for( int i=; i<n; i++ ){
cin>>a[i];
}
for( int i=; i<n; i++ ){
cin>>b[i];
}
sort(a,a+n);
sort(b,b+n,cmp);
int ans=;
for(int i=; i<n; i++ ){
if(a[i]+b[i]>t) ans+=a[i]+b[i]-t;
}
cout<<ans<<endl;
}
return ;
}
Assignments---(贪心)的更多相关文章
- hdu 3661 Assignments (贪心)
Assignments Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- HDU 3661 Assignments (水题,贪心)
题意:n个工人,有n件工作a,n件工作b,每个工人干一件a和一件b,a[i] ,b[i]代表工作时间,如果a[i]+b[j]>t,则老板要额外付钱a[i]+b[j]-t;现在要求老板付钱最少: ...
- Assignments
Assignments Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- German Collegiate Programming Contest 2013-B:Booking(贪心)
Booking Pierre is in great trouble today! He is responsible for managing the bookings for the AC ...
- sgu 195 New Year Bonus Grant【简单贪心】
链接: http://acm.sgu.ru/problem.php?contest=0&problem=195 http://acm.hust.edu.cn/vjudge/contest/vi ...
- 【网络流+贪心】Homework
题目描述 Taro is a student of Ibaraki College of Prominent Computing. In this semester, he takes two cou ...
- BZOJ 1692: [Usaco2007 Dec]队列变换 [后缀数组 贪心]
1692: [Usaco2007 Dec]队列变换 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1383 Solved: 582[Submit][St ...
- HDOJ 1051. Wooden Sticks 贪心 结构体排序
Wooden Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
随机推荐
- WPF参考
web 调用本地exe 程序,传入参数https://www.cnblogs.com/anjou/p/10045177.html WPF常用控件样式https://www.cnblogs.com/s0 ...
- 移动应用开发技术选型:WebApp>HybridApp>NativeApp
一:概念辨析 Web App:生存在浏览器里的应用,只能运行在浏览器里,宿主是浏览器,不是操作系统.资源一般都在网络上,就是一个触屏版的网站.如:微信公众号.不需要在设备上下载安装,只需通过浏览器即可 ...
- Linux学习必备
17,继往开来 实践是检验真理的唯一标准! ---运维技术组----mvpbang #开源代码 https://github.com/ #目前最受欢迎的 https://gitee.com/ ...
- C#/.NET基础视频[2018年][195集完]
B站观看地址-无广告观看 https://www.bilibili.com/video/av21896829/ 前一两集 声音有点大 ,可以调大一点音量. 百度网盘下载地址 https://pan.b ...
- golang 类型转换
import ( "bytes" "encoding/binary" "encoding/gob" "fmt" ) fu ...
- Mssql Server2005中更改sa的用户名的多种方法
mssql安装上去时默认就是sa用户,大多数用户都会一直使用sa这个用户,这样数据库就存在很大的安全问题了,如果我们能把sa用户名修改,这样安全级别又高了一层哦,下面我们来看修改sa用户名的办法. ...
- python3 + flask + sqlalchemy +orm(1):链接mysql 数据库
1.pycharm中新建一个flask项目 2.按装flask.PyMySQL.flask-sqlalchemy 3.项目下面新建一个config.py 文件 DEBUG = True #dialec ...
- js 性能优化利器:prepack
1. js 性能优化 js 本身是没有像 python 一样的预编译功能,更没有像 java 一样的编译功能,所以,这里所说的 js 代码预编译 只是通过工具实现的类似功能而已. 这就要提到 prep ...
- The best manual of how to use "The easiest Xdebug" addon for Firefox
Installation notes 0. Install the best Firefox add-on for remote debugging The easiest Xdebug. I'm n ...
- python – 基于pandas中的列中的值从DataFrame中选择行
如何从基于pandas中某些列的值的DataFrame中选择行?在SQL中我将使用: select * from table where colume_name = some_value. 我试图看看 ...