본문 바로가기

2021/10

1697 : 큐(queue) import java.util.Scanner; public class Main { static int queue[] = new int [101]; static int f; static int r; public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int i, j, n = 0; String arr; int number[] = new int [101]; n = scan.nextInt(); for (i = 0; i < n; i++) { arr = scan.next(); if (arr.charAt(0) == 'i') { int num = scan.nextIn.. 더보기
1102 : 스택 (stack) import java.util.Scanner; public class Main { static int stack[] = new int [101]; static int pos; public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n, i, j; String arr = null; int number[] = new int [101]; n = scan.nextInt(); for (i = 0; i < n; i++) { arr = scan.next(); if (arr.charAt(0) == 'i') { int num = scan.nextInt(); push.. 더보기
1761 : 숫자 야구 import java.util.Scanner; public class Main { public static class Baseball{ int num; int strick; int ball; public Baseball() {} public Baseball(int num,int strick,int ball) { this.num = num; this.strick=strick; this.ball =ball; } } public static void main(String[] args) throws IOException { // TODO Auto-generated method stub int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); Baseball[.. 더보기
3427 : 볼 모으기(balls) import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n; String arr; int i, j; n = scan.nextInt(); arr= scan.next(); int red = 0, blue = 0; int rs = 0, bs = 0; int re=0,be=0; for (i = 0; i < n; i++) { if (arr.charAt(i) == 'R') { red++; } else { blue++; } } for (i = 0;.. 더보기
2259 : 참외밭 import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Scanner; public class Main { public static int arr[][] = new int [21][3]; public static int k; public static int fullarea = 0; public static int cutarea = 0; public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedWriter bw = new BufferedWr.. 더보기
1836 : 연속부분합 찾기 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer .. 더보기
1761 : 숫자 야구 import java.util.Scanner; public class Main { public static class Baseball{ int num; int strick; int ball; public Baseball() {} public Baseball(int num,int strick,int ball) { this.num = num; this.strick=strick; this.ball =ball; } } public static void main(String[] args) throws IOException { // TODO Auto-generated method stub int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); Baseball[.. 더보기
1031 : 빙고 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main { public static int saheja[][] = new int [6][6]; public static int bingopan[][] = new int [6][6]; public static int bingocnt = 0; public static void main(String[] args) throws IOException.. 더보기