Category : addition

Given an array we have to take average of an array and then take floor of that average and that value should be less than k. Link of this question:- https://www.hackerearth.com/practice/data-structures/arrays/1-d/practice-problems/algorithm/minimum-additions-0142ac80/ MY CODE:- #include "bits/stdc++.h" using namespace std; int main() { int t; cin>>t; while(t–){ int n,k; cin>>n>>k; int arr[n]; int s = 0; for(int ..

Read more

#include <iostream> #include <string> using namespace std; namespace ComplexNumberNamespace { typedef struct _Data { double real; double imag; }Data; class ComplexNumber { private: Data data{}; public: ComplexNumber(); ComplexNumber(float real, float imag); ComplexNumber(ComplexNumber&); string to_string(); void operator = (ComplexNumber&); ComplexNumber operator + (ComplexNumber& rhs); }; string ComplexNumber::to_string() { std::string str; str = std::to_string(data.real); str.append(" + i ..

Read more