Smallest triangular number larger than p | CPP code to find the bucket to choose for picking flowers out of it ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int findBucketNo ( int p ) { return ceil ( ( sqrt ( 8 * p + 1 ) - 1 ) / 2 ) ; } int main ( ) { int p = 10 ; cout << findBucketNo ( p ) ; return 0 ; }