#3982. [GESP202406 七级 C++] 第 14 题
[GESP202406 七级 C++] 第 14 题
下面 count_triple 函数的时间复杂度为( )。
int count_triple(int n) {
int cnt = 0;
for (int a = 1; a <= n; a++)
for (int b = a; a + b <= n; b++) {
int c = sqrt(a * a + b * b);
if (a + b + c > n)
break;
if (a * a + b * b == c * c)
cnt++;
}
return cnt;
}
{{ select(1) }}