BOJ: Bronze V Collection

일일이 스레드 올리는 것보다 여기에 한꺼번에 다 담는게 더 효율적일듯 해서 #5522 부터는 여기에 올리겠습니다.

이전 문제들

#1000 [Solved] #1001 [Solved] #1271 [Solved] #1550 [Solved]

#2338 [Solved] #2475 [Solved] #2845 [Solved]

#2914 [Solved] #3046 [Solved] #3003 [Solved]

#5337 [Solved] #5338 [Solved] #5339 [Solved]

#5522 - 카드게임 [Solved]

Java 15
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int input[] = new int[5];
		int sum = 0;
		for(int i = 0; i < input.length; i++) {
			input[i] = sc.nextInt();
			sum += input[i];
		}
		sc.close();
		System.out.println(sum);
	}
}
Haskell - @익명2
main = getContents >>= print . sum . map read . words

#5554 - 심부름 가는 길 [Solved]

Java 15
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int hs = sc.nextInt(), sp = sc.nextInt(), pa = sc.nextInt(), ah = sc.nextInt();
		int sum = hs+sp+pa+ah, min = 0;
		while(sum >= 60) {
			if(sum >= 60) {
			sum -= 60;
			min++;
			}
		}
		System.out.println(min);
		System.out.println(sum);
	}
}
Haskell - @익명2
main = getContents >>= mapM_ print . sequence [(`div` 60), (`mod` 60)] . sum . map read . words

#6749 - Next in line [Solved]

Java 15
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int young = sc.nextInt(), middle = sc.nextInt();
		sc.close();
		int sub = middle - young;
		int oldest = middle + sub;
		System.out.println(oldest);
	}
}
Haskell - @익명2
main = getContents >>= print . (\(x:y:_) -> 2 * y - x) . map read . words

#7287 - 등록 [Solved]

Java 15
public class Main{
	public static void main(String[] args) throws Exception {
		System.out.println("27");
        System.out.println("lake_s");
	}
}

#8370 - Plane [Solved]

Java 15
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n1 = sc.nextInt(), k1 = sc.nextInt(), n2 = sc.nextInt(), k2 = sc.nextInt();
		sc.close();
		int total = n1 * k1 + n2 * k2;
		System.out.println(total);
	}
}
Haskell - @익명2
import Data.List.Split ( chunksOf )

main = getContents >>= print . sum . map product . chunksOf 2 . map read . words

#8393 - 합 [Solved]

Java 15
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), sum = 0;
		sc.close();
		for(int i = 0; i <= n; i++) {
			sum += i;
		}
		System.out.println(sum);
	}
}
Haskell - @익명2
main = getLine >>= print . sum . (\x -> [1..x]) . read

#8437 - Julka [Solved]

Java 15_old
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int apple = sc.nextInt(), diff = sc.nextInt();
		sc.close();
		int klaudia = 0, natalia = 0;
		if(diff % 2 == 0 || apple % 2 != 1) {
			klaudia = (apple / 2) + (diff / 2);
			natalia = (apple / 2) - (diff / 2);
		}
		else {
			klaudia = (apple / 2) + (diff / 2) + 1;
			natalia = (apple / 2) - (diff / 2);
		}
		System.out.println(klaudia);
		System.out.println(natalia);
	}
}
Java 15
import java.math.BigInteger;
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		BigInteger apples = sc.nextBigInteger();
		BigInteger diff = sc.nextBigInteger();
		BigInteger two = new BigInteger("2");
		sc.close();
		System.out.println((apples.add(diff)).divide(two));
		System.out.println((apples.subtract(diff)).divide(two)); // 아직도 이 공식 이해 안됨 미치겠음
	}
}

#9653 - 스타워즈 로고 [Solved]

Java 15
public class Main{
	public static void main(String[] args) throws Exception {
		System.out.println("    8888888888  888    88888");
		System.out.println("   88     88   88 88   88  88");
		System.out.println("    8888  88  88   88  88888");
		System.out.println("       88 88 888888888 88   88");
		System.out.println("88888888  88 88     88 88    888888\n");
		
		System.out.println("88  88  88   888    88888    888888");
		System.out.println("88  88  88  88 88   88  88  88");
		System.out.println("88 8888 88 88   88  88888    8888");
		System.out.println(" 888  888 888888888 88  88      88");
		System.out.println("  88  88  88     88 88   88888888");
	}
}

#9654 - 나부 함대 데이터 [Solved]

Java 15
public class Main{
	public static void main(String[] args) throws Exception {
		System.out.println("SHIP NAME      CLASS          DEPLOYMENT IN SERVICE");
		System.out.println("N2 Bomber      Heavy Fighter  Limited    21        ");
		System.out.println("J-Type 327     Light Combat   Unlimited  1         ");
		System.out.println("NX Cruiser     Medium Fighter Limited    18        ");
		System.out.println("N1 Starfighter Medium Fighter Unlimited  25       ");
		System.out.println("Royal Cruiser  Light Combat   Limited    4         ");
	}
}

#10170 - NFC West vs North [Solved]

Java 15
public class Main{
	public static void main(String[] args) throws Exception {
		System.out.println("NFC West       W   L  T");
		System.out.println("Seattle        13  3  0");
		System.out.println("-----------------------");
		System.out.println("San Francisco  12  4  0");
		System.out.println("Arizona        10  6  0");
		System.out.println("St. Louis      7   9  0");
		System.out.println();
		System.out.println("NFC North      W   L  T");
		System.out.println("-----------------------");
		System.out.println("Green Bay      8   7  1");
		System.out.println("Chicago        8   8  0");
		System.out.println("Detroit        7   9  0");
		System.out.print("Minnesota      5  10  1");
	}
}
1 Like

열심히 푸시는군요 ㅎㅎㅎㅎ
존경합니당

1 Like

#5522

Haskell
main = getContents >>= print . sum . map read . words

#5554

Haskell
main = getContents >>= mapM_ print . sequence [(`div` 60), (`mod` 60)] . sum . map read . words
1 Like

저두 하스켈 잘하고 싶네요 ㅎㅎ

그러고 보니 백준에 하스켈 있었던 거 같은데 지금은 왜 없죠?

하위 문제 5개 풀때마다 그 윗 단계 하나 도전해보세요!
의외로 브론즈 1까지는 하나도 안 어려워서 쑥쑥 올라갈거에여

1 Like

#6749 - Next in line

Haskell
main = getContents >>= print . (\(x:y:_) -> 2 * y - x) . map read . words

#8370 - Plane

Haskell
import Data.List.Split ( chunksOf )

main = getContents >>= print . sum . map product . chunksOf 2 . map read . words

#8393 - 합

Haskell
main = getLine >>= print . sum . (\x -> [1..x]) . read
1 Like