Código C al convertidor Java
#include <stdio.h>
Tumbling Helmet
#include <stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int cmp(int &a,int &b)
{
return a>b;
}
int main()
{
int n;
long int b;
long int sum;
int i;
int count;
int cows[20000];
cin>>n>>b;
for(i=0;i<n;i++)
cin>>cows[i];
sort(cows,cows+n,cmp);
sum=0;
count=0;
for(i=0;i<n;i++)
{
if(sum>=b)
break;
sum+=cows[i];
count++;
}
cout<<count<<endl;
return 0;
}
gfgdgdhdhdhdfghgfhfgh