エラー
最近、__gcd(a, b)
コンピューティングa
とb
最大公約数を使用したい場合、結果で次のエラーが発生しました。
[Error] '__gcd' was not declared in this scope
解決
__gcd()
関数は標準ライブラリ<algorithm>
で定義されているので、追加するだけ#include <algorithm>
です。
例:
#include <cstdio>
#include <algorithm>
using namespace std;
int main(void)
{
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", __gcd(a, b));
return 0;
}