diff --git a/Question-1/Answer-1.cpp b/Question-1/Answer-1.cpp new file mode 100644 index 0000000..520cefc --- /dev/null +++ b/Question-1/Answer-1.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +void solve(){ + int n; + cin >> n; + int arr[n]; + map mp; + for(int i{0}; i> arr[i]; + mp[arr[i]]++; + } + int ans = 0; + for(auto x:mp) ans+=x.second/3; + cout << ans; +} + +int main(){ + int t; + cin >> t; + while(t--){ + solve(); + cout << '\n'; + } + return 0; +} \ No newline at end of file diff --git a/question-2/Answer-2.cpp b/question-2/Answer-2.cpp new file mode 100644 index 0000000..0873cf5 --- /dev/null +++ b/question-2/Answer-2.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; + +void solve(){ + int n; + cin >> n; + int trailing_zeros = 0; + for(int i{5}; i<=n; i*=5) trailing_zeros+=n/i; + cout << trailing_zeros; +} + +int main(){ + int t; + cin >> t; + while(t--){ + solve(); + cout << '\n'; + } + return 0; +} \ No newline at end of file