-
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.
- Loading branch information
1 parent
e5268ef
commit 4835f4d
Showing
2 changed files
with
69 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,25 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: ::: ::: */ | ||
/* Problem Number: 13909 :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: ahchjang <boj.kr/u/ahchjang> +#+ +#+ +#+ */ | ||
/* +#+ +#+ +#+ */ | ||
/* https://boj.kr/13909 #+# #+# #+# */ | ||
/* Solved: 2024/09/10 03:42:03 by ahchjang ### ### ##.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
import java.io.*; | ||
import java.util.*; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int n = sc.nextInt(); | ||
|
||
int answer = (int)Math.sqrt(n); | ||
System.out.println(answer); | ||
} | ||
} |
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,44 @@ | ||
# 13909번: 창문 닫기 - <img src="https://static.solved.ac/tier_small/6.svg" style="height:20px" /> Silver V | ||
|
||
<!-- performance --> | ||
|
||
<!-- 문제 제출 후 깃허브에 푸시를 했을 때 제출한 코드의 성능이 입력될 공간입니다.--> | ||
|
||
<!-- end --> | ||
|
||
## 문제 | ||
|
||
[문제 링크](https://boj.kr/13909) | ||
|
||
|
||
<p>서강대학교 컴퓨터공학과 실습실 R912호에는 현재 N개의 창문이 있고 또 N명의 사람이 있다. 1번째 사람은 1의 배수 번째 창문을 열려 있으면 닫고 닫혀 있으면 연다. 2번째 사람은 2의 배수 번째 창문을 열려 있으면 닫고 닫혀 있으면 연다. 이러한 행동을 N번째 사람까지 진행한 후 열려 있는 창문의 개수를 구하라. 단, 처음에 모든 창문은 닫혀 있다.</p> | ||
|
||
<p>예를 들어 현재 3개의 창문이 있고 3명의 사람이 있을 때,</p> | ||
|
||
<ol> | ||
<li>1번째 사람은 1의 배수인 1,2,3번 창문을 연다. (1, 1, 1)</li> | ||
<li>2번째 사람은 2의 배수인 2번 창문을 닫는다. (1, 0, 1)</li> | ||
<li>3번째 사람은 3의 배수인 3번 창문을 닫는다. (1, 0, 0)</li> | ||
</ol> | ||
|
||
<p>결과적으로 마지막에 열려 있는 창문의 개수는 1개 이다.</p> | ||
|
||
|
||
|
||
## 입력 | ||
|
||
|
||
<p>첫 번째 줄에는 창문의 개수와 사람의 수 N(<strong>1 ≤ N ≤ 2,100,000,000</strong>)이 주어진다.</p> | ||
|
||
|
||
|
||
## 출력 | ||
|
||
|
||
<p>마지막에 열려 있는 창문의 개수를 출력한다.</p> | ||
|
||
|
||
|
||
## 소스코드 | ||
|
||
[소스코드 보기](Main.java) |