69,368
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
int vShowNum( int a, int b, int c, int d)
{
int result = 0;
for ( int i = 0; i < d / a; i ++ )
{
for ( int j = 0; j < d - a * i ; j++ )
{
if ( (d - a*i - j*b)%c == 0 )
{
result++;
}
}
}
return result;
}
int _tmain(int argc, _TCHAR* argv[])
{
cout << vShowNum(5, 2, 1, 10) << endl;
return 0;
}
#include <iostream>
using namespace std;
int vShowNum( int a, int b, int c, int d)
{
int result = 0;
for ( int i = 0; i < d / a; i ++ )
{
for ( int j = 0; j < d - a * i ; j++ )
{
if ( (d - a*i - j*b)%c == 0 )
{
result++;
}
}
}
return result;
}
int _tmain(int argc, _TCHAR* argv[])
{
cout << vShowNum(5, 2, 1, 10) << endl;
return 0;
}