MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / func13

Function func13

CPP/pandigital_numbers/code.cpp:97–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97vector<int> func13(string str, vector<int> &values)
98{
99 int num = stoi(str);
100 int a, b;
101 b = num % 10;
102 num /= 10;
103 a = num % 10;
104 num /= 10;
105
106 vector<int> vec;
107
108 for (int i = 0; i < values.size(); i++)
109 {
110 // Subtract the last two digits from four times the rest. The result must be divisible by 13.
111 if ((abs(b * 10 + i - 4 * a)) % 13 == 0 && values[i] == 0)
112 {
113 vec.push_back(i);
114 }
115 }
116
117 return vec;
118}
119
120vector<int> func17(string str, vector<int> &values)
121{

Callers 1

funcFunction · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected