Untitled
unknown
c_cpp
2 years ago
416 B
4
Indexable
#include <iostream> using namespace std; int main() { int disk = 0; int users = 0; int half_memory = 0; int u2 = 0; int u_am = 0; int u_mame; cin >> disk >> users; half_memory = disk / 2; for (int memory_u = 0; memory_u < users; memory_u++) { cin >> u_mame; if (u_mame <= half_memory and not (u2+u_mame > disk)) { u2 += u_mame; u_am++; } } cout << u_am; }
Editor is loading...
Leave a Comment