#include <iostream> using namespace std; int main(){ long long S, t=1, cnt=0, sum=0; cin >> S; while(1){ sum+=t; cnt++; if(sum>S){ cnt--; break; } t++; } cout << cnt << "\n"; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter