반응형 IT Blog414 [백준] 2446번: 별 찍기 - 9 https://www.acmicpc.net/problem/2446 2446번: 별 찍기 - 9 첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다. www.acmicpc.net 코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int col = 0; // 위쪽 행(N-1개) for(int i=0; i 2020. 1. 16. [백준] 2445번: 별 찍기 - 8 https://www.acmicpc.net/problem/2445 2445번: 별 찍기 - 8 첫째 줄부터 2×N-1번째 줄까지 차례대로 별을 출력한다. www.acmicpc.net 코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int col = 0; int space = 2; // 윗줄(N개) for(int i=1; i 2020. 1. 16. [백준] 10820번: 문자열 분석 https://www.acmicpc.net/problem/10820 10820번: 문자열 분석 문자열 N개가 주어진다. 이때, 문자열에 포함되어 있는 소문자, 대문자, 숫자, 공백의 개수를 구하는 프로그램을 작성하시오. 각 문자열은 알파벳 소문자, 대문자, 숫자, 공백으로만 이루어져 있다. www.acmicpc.net 코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while(scan.hasNextLine()) { String str = scan.nextLine(); int small = 0;// 소문자 int big = 0.. 2020. 1. 16. [백준] 5073번: 삼각형과 세 변 https://www.acmicpc.net/problem/5073 5073번: 삼각형과 세 변 문제 삼각형의 세 변의 길이가 주어질 때 변의 길이에 따라 다음과 같이 정의한다. Equilateral : 세 변의 길이가 모두 같은 경우 Isosceles : 두 변의 길이만 같은 경우 Scalene : 세 변의 길이가 모두 다른 경우 단 주어진 세 변의 길이가 삼각형의 조건을 만족하지 못하는 경우에는 "Invalid" 를 출력한다. 예를 들어 6, 3, 2가 이 경우에 해당한다. 가장 긴 변의 길이보다 나머지 두 변의 길이의 합이 길지 않으면 삼각형 www.acmicpc.net 코드 import java.util.Scanner; public class Main { // 1) static int maxNum(.. 2020. 1. 16. 이전 1 ··· 39 40 41 42 다음 반응형