본문 바로가기

프로그래밍 문제/백준

(17)
[백준] 10817번 : 세 수 - java 1234567891011121314151617181920212223242526272829import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int num3 = sc.nextInt(); int temp = 0; if(num2
[백준] 5543번 : 상근날드 - java 12345678910111213141516171819202122232425import java.util.Scanner; public class Main { public static void main(String[] args) { final int DC = 50; Scanner sc = new Scanner(System.in); int hamburger1 = sc.nextInt(); int hamburger2 = sc.nextInt(); int hamburger3 = sc.nextInt(); int coke = sc.nextInt(), cider = sc.nextInt(); int set1 = 0, set2 = 0, set3 = 0; set1 = (hamburger1+coke-DC
[백준] 10039번 : 평균 점수 - java 123456789101112131415161718192021import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int score = 0; int student = 0; int sum = 0; while (student
[백준] 1110번 : 더하기 사이클 - java 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 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int org_num = sc.nextInt(); int old_num = org_num; int new_num = -1; // 새로 만들어진 수 int temp_num1 = 0, temp_num2 = 0; // 10의 자리, 1의 자리 int temp_num3 = 0; // 합한 수 int count = 0; while (org_num != new_num){..
[백준] 10951번 : A+B(4) - java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = 0; int num2 = 0; while (sc.hasNext()){ num1 = sc.nextInt(); num2 = sc.nextInt(); System.out.println(num1+num2); } } } Colored by Color Scripter cs hasNext() 함수 함수를 몰라서 꽤 해맸던 문제다. hasNext는 키보드로부터 입력 값이 존재하는지 없는지를 판단하고 있다면 tru..
[백준] 10952번 : A+B(5) - java 1234567891011121314151617181920import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = 0; int num2 = 0; while (true){ num1 = sc.nextInt(); num2 = sc.nextInt(); if ((num1 == 0) && (num2 == 0)) break; System.out.println(num1+num2); } sc.close(); }}Colored by Color Scriptercs
[백준] 10871번 : X보다 작은 수 1234567891011121314151617import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); int condition = sc.nextInt(); int num = 0; for (int i=0; i
[백준] 2439번 : 별 찍기2 - java 12345678910111213141516171819import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int line = sc.nextInt(); for (int i=0; i
[백준] 2438번 : 별 찍기1 - java 1234567891011121314import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int line = sc.nextInt(); for (int i=0; i
[백준] 11022번 : A+B - java 12345678910111213141516import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); int num1 = 0; int num2 = 0; for (int i=1; i
[백준] 11021번 : A+B - java 12345678910111213141516import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); int num1 = 0; int num2 = 0; for (int i=1; i
[백준] 2742번 : 기찍 N - java 123456789101112import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); for (; 1