hdu 3139 Soda Surpler

虽然我错了很多次,但我还是得说,这题太水了……跟当年刚学C语言时的等差数列求和差不多……

#include <iostream> using namespace std; int main() { int i, j, k, drink, left; while( cin >> i >> j >> k ) { left = i + j; drink = 0; do { drink += left / k; left = left % k + left / k; } while( left >= k ); cout << drink << endl; } return 0; }

你可能感兴趣的:(hdu 3139 Soda Surpler)