-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bronze III] Title: 완전 제곱수, Time: 116 ms, Memory: 114328 KB -BaekjoonHub
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [Bronze III] 완전 제곱수 - 6131 | ||
|
||
[문제 링크](https://www.acmicpc.net/problem/6131) | ||
|
||
### 성능 요약 | ||
|
||
메모리: 114328 KB, 시간: 116 ms | ||
|
||
### 분류 | ||
|
||
사칙연산, 브루트포스 알고리즘, 수학 | ||
|
||
### 문제 설명 | ||
|
||
<p>상근이는 선영이와 함께 게임을 하고 있다. 먼저, 상근이는 두 양의 정수 A와 B를 고른다. (1 ≤ B ≤ A ≤ 500) 그 다음, 선영이는 상근이가 고른 수를 맞춰야 한다.</p> | ||
|
||
<p>상근이는 선영이에게 다음과 같은 힌트를 주었다.</p> | ||
|
||
<blockquote> | ||
<p>A의 제곱은 B의 제곱보다 N만큼 커 (1 ≤ N ≤ 1,000)</p> | ||
</blockquote> | ||
|
||
<p>위의 힌트 조건을 만족하는 A와 B 쌍의 개수를 구하는 프로그램을 작성하시오.</p> | ||
|
||
### 입력 | ||
|
||
<p>첫째 줄에 N이 주어진다.</p> | ||
|
||
### 출력 | ||
|
||
<p>상근이의 힌트 조건을 만족하는 (A,B) 쌍의 개수를 출력한다. </p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
N = int(input()) | ||
cnt = 0 | ||
for i in range(1, N): | ||
if i**2 - (i-1)**2 > N: | ||
break | ||
for j in range(1, i+1): | ||
if i**2 - j**2 == N: | ||
cnt += 1 | ||
print(cnt) |