목록[IT]/백준 (58)
할껀하고놀자
#include #include using namespace std; int main() { int num; cin >> num; int * arr = new int[num]; for (int i = 0; i > arr[i]; } sort(arr, arr + num); int sum = 0; for (int i = 0; i n; vector a(n); for (int i = 0; i > a[i]; } sort(a.begin(), a.end(..
#include #include using namespace std; bool compare(int a, int b) { return a > b; } int main() { int n, val; cin >> n; cin >> val; int *arr = new int[n]; for (int i = 0; i > arr[i]; } sort(arr, arr + n,compare); int result = 0; for (int i = 0; i < n; i++) { result += val / arr[i]; val %= arr[i]; } cout
#include using namespace std; int main() { int n; cin >> n; n = 1000 - n; int result = 0; result += n / 500; n %= 500; result += n / 100; n %= 100; result += n / 50; n %= 50; result += n / 10; n %= 10; result += n / 5; n %= 5; result += n / 1; cout
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { static int [] dy = {0,0,1,-1}; static int [] dx = {1,-1,0,0}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int l = sc.nextInt(); int r = sc.nextInt(); int [][] a = new int [n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { a[i]..
import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { static int [] dy = {0,0,1,-1}; static int [] dx = {1,-1,0,0}; static Shark bfs(int [][]a,int sy,int sx,int size) { int n = a.length; ArrayList arr = new ArrayList(); int [][] d = new int [n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { d[i][j] = -1; } ..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/nUt6H/btqvC7hzhn7/WUA0PbVVOIeHG8NsCF3Po1/img.png)
포인트 : Stringbuffer 를 사용. 배열을 정렬한 다음 -> reverse() 함수를 이용하여 쉽게 풀었다..! import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String []num = br.readLine().split(..
package for문연습; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int num = Integer.parseInt(br.readLine()); int count = num; for (int i = 0; i < num; i++) { String s = br.readLine(); String [] sp = s...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String sp = br.readLine(); String [] arr = {"c=","c-","dz=","d-","lj","nj","s=","z="}; for (int i = 0; i < arr.length; i++) { sp = sp.replace(arr[i], "..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bz3Hwp/btqvzwoEyvb/SueR9KY4M1ci3SYo9d7YX1/img.png)
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String [] sp = br.readLine().split(""); int [] arr= {3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10}; int result = 0; for (int i = 0; i < sp.l..