
#include <iostream> int main( void ) { const unsigned coke_price = 29; const unsigned soda_price = 17; const unsigned amount = 802; for( unsigned coke=1; coke*(coke_price+soda_price)<amount; ++coke ) { if( (amount-coke*coke_price)%soda_price == 0 ) std::cout << coke << std::endl; } }
[此贴子已经被作者于2020-7-7 15:53编辑过]