排序水题

 #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的更多相关文章

  1. CodeForces 609A USB Flash Drives

    水题 #include<cstdio> #include<cmath> #include<algorithm> using namespace std; +; in ...

  2. 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 ...

  3. 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 ...

  4. CodeForce---Educational Codeforces Round 3 USB Flash Drives (水题)解题报告

    对于这题明显是用贪心算法来解决问题: 下面贴出笔者的代码: #include<cstdio> #include<iostream> #include<algorithm& ...

  5. 【Henu ACM Round#17 B】USB Flash Drives

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 排序,逆序.贪心选较大的就好. [代码] #include <bits/stdc++.h> #define ll lon ...

  6. WinSetupFromUSB – Install Windows XP from USB Flash Drive

    http://myeeeguides.wordpress.com/2008/11/15/winsetupfromusb-install-windows-xp-from-usb-flash-drive/ ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. eclipse中切换jre后报错:Java compiler level does not match the version of the installed Java project facet.

    项目移除原来的jre环境lib后,添加本地的jre,报错如下: Java compiler level does not match the version of the installed Java ...

  2. Nagios+msn+fetion自定义时间发送报警消息

    转自http://blog.csdn.net/deccmtd/article/details/6063467 Nagios+fetion发送手机报警使用了几个月.每次报警短信来都要看下手机.感觉麻烦. ...

  3. hdu 1760 A New Tetris Game 博弈论

    找sg值,可以选择暴力,也可以利用sg值的特点简化. 暴力就跟取石子一样,没什么差别,DFS搞定.把矩阵看成一个字符串,字符串就是一个状态. 其实我们也可以不暴力求sg值,因为只要当前状态能到达一个s ...

  4. WIN7+Ubuntu双系统,win7启动不了

    在网上搜索了下,大多说的是因为重装引起的坏道, 我经过半天的搜索才找到了问题所在,首先看看下面连接的二楼大神给出的解决方案: https://forum.ubuntu.org.cn/viewtopic ...

  5. EntityFreamWork和Mvc 精品知识点

    定义了DbRepository<TEntity>:IRepository<TEntity> ,SimpleDbContext继承了DbContext, UnitOfWork:I ...

  6. 【NOIP 2016 总结】

    距离杯赛已经很久了,然而我现在才打总结.. 我好惨的说..两场才380... DAY 1 第一题 toy 送分题,模拟的时候+一下再mod一下就好. [当时打完这题就没再看一眼了,好方的说] #inc ...

  7. Qt:使用自定义的字体

    Qt:使用自定义的字体 1. 下载字体文件 2. 加载字体文件 3. 使用字体   QFontDatabase::addApplicationFont("XENOTRON.TTF" ...

  8. 如何快速查看linux的发行版信息

    思路一: 在CentOS中想查看发行版信息,输入了lsb_release -a 命令却报错了,通过输入以下命令进行安装 yum install redhat-lsb -y 然后继续查看发行版信息 [r ...

  9. 去掉php框架CI默认url中的index.php

    CI默认的rewrite url中是类似这样的 例如你的CI根目录是在/CodeIgniter/下,你的下面的二级url就类似这样 http://localhost/CodeIgniter/index ...

  10. android SharedPreferences apply和commit的区别

    1.apply没有返回值而commit返回boolean表明修改是否提交成功2.apply是将修改数据原子提交到内存, 而后异步真正提交到硬件磁盘, 而commit是同步的提交到硬件磁盘3.apply ...