Answers for "in instantiation of function template specialization 'std::__1::__gcd<int>' requested here"

0

in instantiation of function template specialization 'std::__1::__gcd<int>' requested here

#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
int n;
cin >> n;
vector<int> a(n);

for(int i = 0; i < n; ++i)
    cin >> a[i];

int ans = a[0];
for(int i = 1; i < n; ++i)
   ans = gcd(ans, a[i]);

cout << ans << endl;

return 0;
}
Posted by: Guest on July-25-2021

Browse Popular Code Answers by Language