c++ || solution
\nclass Solution {\npublic:\n    int countDistinct(vector<int>& nums, int k, int p) {\n        int n=nums.size();\n        \n\n        set<string> s;\n        \
```\nclass Solution {\npublic:\n    int countDistinct(vector<int>& nums, int k, int p) {\n        int n=nums.size();\n        \n\n        set<string> s;\n        \n\n        for(int i=0;i<n;i++)\n        {\n            int count=0;\n            int sum=0;\n            string str="";\n            for(int j=i;j<n;j++)\n            {\n                str+=to_string(nums[j]);\n                str+=\'.\';\n                \n                \n                if(nums[j]%p==0)count++;\n                if(count>k) break;\n                s.insert(str);\n            }\n        }\n        return s.size();\n    }\n};\n```
[]