UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215408#996. 换零钱Program01_SanSan100110ms1252kbC++11598b2024-12-07 09:59:122024-12-07 09:59:13

answer

#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= m; i++)
        for (int j = 1; j <= m - i; j++)
            for (int k = 1; k <= m - i - j; k++)
                for (int l = 1; l <= m - i - j - k; l++)
                {
                    if (i + j + k + l != m)
                        continue;
                    if (i * 10 + j * 5 + k * 2 + l * 1 == n)
                        ans++;
                }
    cout << ans;
    return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

150 30

output:

27

result:

ok single line: '27'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

200 50

output:

96

result:

ok single line: '96'

Test #3:

score: 10
Accepted
time: 1ms
memory: 1248kb

input:

196 40

output:

51

result:

ok single line: '51'

Test #4:

score: 10
Accepted
time: 28ms
memory: 1252kb

input:

388 187

output:

520

result:

ok single line: '520'

Test #5:

score: 10
Accepted
time: 15ms
memory: 1248kb

input:

373 168

output:

523

result:

ok single line: '523'

Test #6:

score: 10
Accepted
time: 12ms
memory: 1252kb

input:

255 149

output:

136

result:

ok single line: '136'

Test #7:

score: 10
Accepted
time: 17ms
memory: 1248kb

input:

316 160

output:

308

result:

ok single line: '308'

Test #8:

score: 10
Accepted
time: 26ms
memory: 1252kb

input:

276 178

output:

115

result:

ok single line: '115'

Test #9:

score: 10
Accepted
time: 1ms
memory: 1248kb

input:

376 62

output:

75

result:

ok single line: '75'

Test #10:

score: 10
Accepted
time: 10ms
memory: 1252kb

input:

201 139

output:

42

result:

ok single line: '42'