1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <string>
using namespace std;
void lim( int n, int sum, string &mn, string &mx )
{
// Code goes here
// .....
}
int main()
{
struct Test{ int n, sum; };
Test tests[] = { { 1, 0 }, { 2, 0 }, { 1, 1 }, { 1, 5 }, { 1, 9 }, { 2, 15 }, { 2, 18 }, { 2, 19 }, { 3, 10 }, { 99, 900 }, { 100, 900 }, { 50, 99 } };
for ( Test t : tests )
{
string mn, mx;
lim( t.n, t.sum, mn, mx );
cout << "n = " << t.n << " sum = " << t.sum << " minimum = " << mn << " maximum = " << mx << '\n';
}
}
|