124. The Hotel with Infinite Rooms
user_6817964
c_cpp
3 years ago
380 B
12
Indexable
int D_size(int S, int D);
int D_size(int S, int D) {
int people = 0;
while (1) {
if (D <= (people + S)) {
return S;
break;
}
else {
people += S;
S += 1;
}
}
}
int main() {
int S, D;
scanf("%d %d", &S, &D);
printf("%d", D_size(S, D));
return 0;
}Editor is loading...