codeforce 609A - USB Flash Drives
排序水题
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std; int n,m;
int a[]; int main()
{
scanf("%d",&n);
scanf("%d",&m);
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
int ans=;
int num=;
for(int i=n-;i>=;i--)
{
ans+=a[i];
if(ans>=m)
{
num++;
break;
}
num++;
}
cout<<num<<endl;
return ;
}
codeforce 609A - USB Flash Drives的更多相关文章
- CodeForces 609A USB Flash Drives
水题 #include<cstdio> #include<cmath> #include<algorithm> using namespace std; +; in ...
- CF# Educational Codeforces Round 3 A. USB Flash Drives
A. USB Flash Drives time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Educational Codeforces Round 3 A. USB Flash Drives 水题
A. USB Flash Drives 题目连接: http://www.codeforces.com/contest/609/problem/A Description Sean is trying ...
- CodeForce---Educational Codeforces Round 3 USB Flash Drives (水题)解题报告
对于这题明显是用贪心算法来解决问题: 下面贴出笔者的代码: #include<cstdio> #include<iostream> #include<algorithm& ...
- 【Henu ACM Round#17 B】USB Flash Drives
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 排序,逆序.贪心选较大的就好. [代码] #include <bits/stdc++.h> #define ll lon ...
- WinSetupFromUSB – Install Windows XP from USB Flash Drive
http://myeeeguides.wordpress.com/2008/11/15/winsetupfromusb-install-windows-xp-from-usb-flash-drive/ ...
- UEFI Bootable USB Flash Drive - Create in Windows(WIN7 WIN8)
How to Create a Bootable UEFI USB Flash Drive for Installing Windows 7, Windows 8, or Windows 8.1 In ...
- LPCScrypt, DFUSec : USB FLASH download, programming, and security tool, LPC-Link 2 Configuration tool, Firmware Programming
What does this tool do? The LPC18xx/43xx DFUSec utility is a Windows PC tool that provides support f ...
- Rufus-Create bootable USB drives the easy way
Rufus Create bootable USB drives the easy way Rufus is a utility that helps format and create bootab ...
随机推荐
- 编写你的第一个 Django 程序 第1部分
原地址:http://django-chinese-docs.readthedocs.org/en/latest/intro/tutorial01.html 让我们通过例子来学习. 在本教程中,我们将 ...
- fiddler 插件开发
本文主要讲解使用.net C#语言开发Fiddler插件. 1.在Fiddler 会话列表中添加自定义列 使用FiddlerApplication.UI.lvSessions.AddBoundColu ...
- Host Definition
Description: A host definition is used to define a physical server, workstation, device, etc. that r ...
- hdu 4577 X-Boxes 大数
java水过…… 代码如下: import java.math.*; import java.util.*; public class Main { public static void main(S ...
- php获取类的实例变量
<?php class Page {private $title; //构造函数固定名称为__construct,这样能将php的类构造函数独立于类名,以后修改类名就无需修改构造函数名称 fun ...
- 一个隐晦的c++语法问题
转:http://www.cnblogs.com/lancidie/archive/2013/04/13/3019596.html typedef MyData { int data1; int da ...
- python学习笔记七--数据操作符
一.Python表达式操作符及程序:
- ASCII码表详解
第一部分:ASCII非打印控制字符表 ASCII表上的数字0–31分配给了控制字符,用于控制像打印机等一些外围设备.例如,12代表换页/新页功能.此命令指示打印机跳到下一页的开头.(参详ASCII码表 ...
- WinAPI——UnhookWindowsHookEx - 卸掉钩子
UnhookWindowsHookEx( hhk: HHOOK {钩子句柄} ): BOOL; {True/False}
- Android开发UI之给ImageView添加蒙版
ImageView控件添加蒙版, 通过属性:android:tint="" 比如 android:tint="#44ff0000"