Skip to content

Commit

Permalink
BOJ-EX: 2024. 9. 10. 오전 4:05:33
Browse files Browse the repository at this point in the history
  • Loading branch information
MinhoJJang committed Sep 9, 2024
1 parent e5268ef commit 4835f4d
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 13909번: 창문 닫기/Main.java
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);
}
}
44 changes: 44 additions & 0 deletions 13909번: 창문 닫기/README.md
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의 배수 번째 창문을 열려 있으면 닫고 닫혀 있으면 연다.&nbsp; 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의 배수인&nbsp;3번 창문을 닫는다. (1, 0, 0)</li>
</ol>

<p>결과적으로 마지막에 열려 있는 창문의 개수는 1개 이다.</p>



## 입력


<p>첫 번째 줄에는 창문의 개수와 사람의 수 N(<strong>1 ≤ N ≤ 2,100,000,000</strong>)이 주어진다.</p>



## 출력


<p>마지막에 열려 있는 창문의 개수를 출력한다.</p>



## 소스코드

[소스코드 보기](Main.java)

0 comments on commit 4835f4d

Please sign in to comment.