Advertisement
farhansadaf

TheInfiniteHotelRoom

May 7th, 2018
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int s, d;
  6.     while(scanf("%d %d", &s, &d) != EOF){
  7.         int a[1000], index = 0;
  8.         for(int i=1; i<=d; i++){
  9.             for(int j=1; j<=s; j++){
  10.                 a[index] = s;
  11.                 index++;
  12.             }
  13.             s++;
  14.         }
  15.         printf("%d\n", a[d-1]);
  16.     }
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement