标签:des style blog http java color
| Time Limit: 2000MS | Memory Limit: 65536K | |
| Total Submissions: 5416 | Accepted: 2452 |
Description
Input
Output
Sample Input
10 80 70 15 30 35 10 80 20 35 10 30
Sample Output
6
Hint

Source
) java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//Scanner scan=new Scanner (System.in);
StreamTokenizer st = new StreamTokenizer(new BufferedReader(
new InputStreamReader(System.in)));
st.nextToken();
int t=(int)st.nval;
for(int i=0;i<t;i++){
st.nextToken();
int n=(int)st.nval;
st.nextToken();
int l=(int)st.nval;
int count=0;
int a[]=new int[n];
for(int j=0;j<n;j++){
st.nextToken();
a[j]=(int)st.nval;
}
Arrays.sort(a);
for(int j=0,k=n-1;j<=k;){
if(a[j]+a[k]<=l){
count++;
j++;k--;
}
else{
count++;
k--;
}
}
if(i!=0)
System.out.println();
System.out.println(count);
}
}
}
POJ 2782 Bin Packing,布布扣,bubuko.com
标签:des style blog http java color
原文地址:http://blog.csdn.net/kimi_r_17/article/details/37909439