목록전체 글 (159)
할껀하고놀자
#include #include using namespace std; int a[100001]; int n; int main() { cin >> n; for (int i = 0; i > a[i]; } sort(a, a + n); int max = 0; for (int i = 0; i < n; i++) { if (max < a[i] * (n - i)) max = a[i] * (n - i); } cout
#include #include using namespace std; int main() { int num; cin >> num; int * arr = new int[num]; for (int i = 0; i > arr[i]; } sort(arr, arr + num); int sum = 0; for (int i = 0; i n; vector a(n); for (int i = 0; i > a[i]; } sort(a.begin(), a.end(..
#include #include using namespace std; bool compare(int a, int b) { return a > b; } int main() { int n, val; cin >> n; cin >> val; int *arr = new int[n]; for (int i = 0; i > arr[i]; } sort(arr, arr + n,compare); int result = 0; for (int i = 0; i < n; i++) { result += val / arr[i]; val %= arr[i]; } cout