Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7.     int n;
  8.     cin >> n;
  9.  
  10.     int suma = 0;
  11.     int dodaj = 0;
  12.     int ostatni = 1;
  13.  
  14.     int dzien = 0;
  15.  
  16.     while(suma < n){
  17.         suma += ostatni + dodaj;
  18.         ostatni = ostatni + dodaj;
  19.         dodaj++;
  20.         dzien++;
  21.     }
  22.  
  23.     cout << dzien << endl;
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement