1class Solution {2 public:3 int countTriples(int n) {4 int res = 0;5 for (int a = 3, sqa; a < n; a++) {6 sqa = a * a;7 for (int b = 3, sqc, c; b < n; b++) {8 sqc = sqa + b * b;9 c = sqrt(sqc);10 if (c > n) break;11 res += c * c == sqc;12 }13 }14 return res;15 }16};
WPM •0 •0
ACC •0 •0
TIME •0