排序水题

 #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. Matlab计算矩阵间距离

    夜深人静时分,宿舍就我自己,只有蚊子陪伴着我,我慢慢码下这段文字............ 感觉知识结构不完善:上学期看论文,发现类间离散度矩阵和类内离散度矩阵,然后百度,找不到,现在学模式识别,见了, ...

  2. Detect loop in a singly linked list

    去Twitter面试的被问到这个问题,当时只想到了用HashMap的办法,这种办法时间复杂度O(n),空间复杂度是O(n), 更好的办法是用 FastRunner / SlowRunner appro ...

  3. BZOJ 1706: [usaco2007 Nov]relays 奶牛接力跑

    Description FJ的N(2 <= N <= 1,000,000)头奶牛选择了接力跑作为她们的日常锻炼项目.至于进行接力跑的地点 自然是在牧场中现有的T(2 <= T < ...

  4. 团体程序设计天梯赛-练习集L1-007. 念数字

    L1-007. 念数字 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 翁恺 输入一个整数,输出每个数字对应的拼音.当整数为负数时,先 ...

  5. TIANKENG’s restaurant

    Problem B:http://codeforces.com/contest/616/problem/B B. Dinner with Emma 题意:一对夫妻要去餐厅吃晚饭,Emma 想去最豪华( ...

  6. zoj 2387

    额  一个贪心  好难想到 ...... #include <cstring> #include <cstdio> #include <algorithm> #in ...

  7. Makefile教程

    Makefile学习教程: 跟我一起写 Makefile 0 Makefile概述 0.1 关于程序的编译和链接 1 Makefile 介绍 1.1 Makefile的规则 1.2 一个示例 1.3 ...

  8. tomcat配置301重定向(urlRewrite URL重写)

    tomcat默认情况下不带www的域名是不会跳转到带www的域名的,而且也无法像apache那样通过配置.htaccess来实现.如果想要把不带“www'的域名重定向到带”www"域名下,又 ...

  9. 【疯狂Java讲义学习笔记】【流程控制与数组】

    [学习笔记]1.switch语句后的expression表达式的数据类型只能是byte.short.char.int四个整数类型.String(Java 7后才支持)和枚举类型. 2.数组的长度不可变 ...

  10. [itint5]直角路线遍历棋盘

    http://www.itint5.com/oj/#22 这题一开始直接用暴力的DFS来做,果然到25的规模就挂了. vector<bool> visited(50, false); ve ...