http://acm.hdu.edu.cn/diy/contest_showproblem.php?pid=1004&cid=22818
Problem Description
Input
Output
Sample Input
10 1
Sample Output
13
Author
Source
#include <iostream> using namespace std; ; int main() {double t,q,p,b; while(cin>>t>>q) {int n,i,u=0; b=n=t/q; for(i=1;i<5000;i++) {if(n>i+1) {n=n-i;u++;} else break; } if(b*q==t) cout<<b+u<<endl; else cout<<b+u+1<<endl; } return 0; }