Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- math
- binary search
- oracle
- 이분탐색
- BFS
- BOJ
- 투포인터
- Java
- SWEA
- 시뮬레이션
- 프로그래머스
- COS PRO
- 문제해결
- 알고리즘
- 문제풀이
- SQL
- 운동기록
- 백준
- 자바
- db
- 러닝일지
- priorityqueue
- 코딩테스트
- MySQL
- 문자열
- 코테
- DP
- greedy
- dfs
- 건강
Archives
- Today
- Total
슈콩
[BOJ] 백준 6359 만취한 상범 본문
[문제]
https://www.acmicpc.net/problem/6359
[소스 코드]
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while(t-->0) {
int n = Integer.parseInt(br.readLine());
boolean[] open = new boolean[n+1];
Arrays.fill(open, true);
for(int i=2;i<=n;i++) {
for(int j=i;j<=n;j+=i) {
open[j] = !open[j];
}
}
int result = 0;
for(int i=1;i<=n;i++) {
if(open[i])
result++;
}
System.out.println(result);
}
}
}'Algorithms > Baekjoon' 카테고리의 다른 글
| [BOJ] 백준 9613 GCD 합 (0) | 2025.09.16 |
|---|---|
| [BOJ] 백준 9020 골드바흐의 추측 (0) | 2025.09.15 |
| [BOJ] 백준 5347 LCM (0) | 2025.09.15 |
| [BOJ] 백준 3343 장미 (0) | 2025.09.15 |
| [BOJ] 백준 3343 캠핑 (0) | 2025.09.15 |