MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Divisible Sum Pairs/solution.cpp:30–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30int main()
31{
32 ofstream fout(getenv("OUTPUT_PATH"));
33
34 string nk_temp;
35 getline(cin, nk_temp);
36
37 vector<string> nk = split_string(nk_temp);
38
39 int n = stoi(nk[0]);
40
41 int k = stoi(nk[1]);
42
43 string ar_temp_temp;
44 getline(cin, ar_temp_temp);
45
46 vector<string> ar_temp = split_string(ar_temp_temp);
47
48 vector<int> ar(n);
49
50 for (int i = 0; i < n; i++) {
51 int ar_item = stoi(ar_temp[i]);
52
53 ar[i] = ar_item;
54 }
55
56 int result = divisibleSumPairs(n, k, ar);
57
58 fout << result << "\n";
59
60 fout.close();
61
62 return 0;
63}
64
65vector<string> split_string(string input_string) {
66 string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) {

Callers

nothing calls this directly

Calls 2

divisibleSumPairsFunction · 0.85
split_stringFunction · 0.70

Tested by

no test coverage detected