MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / brute_force

Function brute_force

test/test_linear_diophantine.cpp:10–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "linear_diophantine_all.h"
9
10int brute_force(int a, int b, int c, int minx, int maxx, int miny, int maxy) {
11 int ans = 0;
12 for (int x = minx; x <= maxx; x++) {
13 for (int y = miny; y <= maxy; y++) {
14 if (x * a + y * b == c) ans++;
15 }
16 }
17 return ans;
18}
19
20void test(int a, int b, int c, int minx, int maxx, int miny, int maxy) {
21 int expected = brute_force(a, b, c, minx, maxx, miny, maxy);

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected