Shawn's Blog

  • Home
  • Tags
  • Categories
  • Archives
  • Search
  • Table of Contents
  • Overview

Shawn

若有恒,何必三更眠五更起;最无益,莫过一日曝十日寒。
392 posts
13 categories
114 tags

LeetCode 1925. Count Square Sum Triples1925. Count Square Sum Triples

Posted on 2021-07-11 Edited on 2024-11-24 In LeetCode
1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
public:
int countTriples(int n) {
int ans = 0;
for (int a = 1; a <= n; ++a)
for (int b = 1; b <= n; ++b)
for (int c = 1; c <= n; ++c)
if (a * a + b * b == c * c)
++ans;
return ans;
}
};
# Greedy# Array
AcWing 3760. 最大剩余油量
LeetCode 1926. Nearest Exit from Entrance in Maze1926. Nearest Exit from Entrance in Maze
© 2024 Shawn
Powered by Hexo & NexT.Mist
0%