Study
2008. 5. 31. 01:07
20개의 0~9까지의 숫자를 입력받아, 최대빈도수와 빈도수 구하기
import java.io.*; class Bindo { public static void main(String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int num; int count[] = new int[10]; String input; for(int i=0;i<20; i++) { input = in.readLine(); num = Integer.parseInt(input); count[num] ++; } int max = -1; for(int i=0;i<10;i++) { if(count[i]>=max) max=i; } System.out.println("가장 빈도수가 많은 수는 " + max + " 빈도수 " + count[max]); } }
공유하기
게시글 관리
구독하기
솔직한 목소리
blog
profile
tag cloud
travel log
guest book
by
bslime
전체보기
(52)
목소리
(1)
영화
(0)
음악
(0)
Study
(34)
Security
(12)
Web
(2)
WLAN
(7)
Network
(1)
System
(1)
Wargame
(5)
Web
(0)
Reverse Engineering
(3)
Crypto
(2)
폐인
Maze
CTF
padocon
티스토리
삽질
미로
Algorithm
잘했어요
초대장
«
2024/05
»
일
월
화
수
목
금
토
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
darktoil.
인생여전龍군.
슝이.
MR-J@.
미움.
vvipbeom.
Copyright ⓒ 2010.
bslime
, Skin designed by
Creasmworks.
All rights reserved.
티스토리툴바