A, B = map(str, input().split())
if "6" in A or "6" in B:
    A = A.replace("6","5")
    B = B.replace("6","5")
_min = sum(map(int, [A, B]))

if "5" in A or "5" in B:
    A = A.replace("5","6")
    B = B.replace("5","6")
_max = sum(map(int, [A, B]))
print (_min, _max)
#include <iostream>

#define BIG 5
#define SMALL 3

using namespace std;

int Solution(int N)
{
	int quoteB = N / BIG; // 큰 설탕의 upper bound를 우선 결정
	
	while(true)
	{
		
		int Remainder = N - (BIG * quoteB); // 큰 설탕의 개수에 따라 나머지 결정 
		if (Remainder % SMALL == 0)	// 나머지가 작은 설탕으로 딱 떨어질 경우, 큰 설탕 개수 + 작은 설탕 개수 반환 
		{
			int quoteS = Remainder / SMALL;
			return quoteB+quoteS;
		}
		
		if (quoteB == 0)
			break;
			
		quoteB = quoteB -1;
	}
	
	return -1;
	
}

int main(void)
{
	int N = 0;
	
	cin >> N;
	
	if (N>=3 and N<=5000)
	{
		int result = Solution(N);
		cout << result;
	}
	
	return 0;
}
#include <iostream>
using namespace std;

bool checkLeapYear(int year)
{
	if ((year % 4 == 0 and year % 100 != 0) or (year % 4 ==0 and year % 400 == 0))
	{
		return true;
	}
	
	else
	{
		return false;
	}
}

int main(void)
{
	int result = -1; // 여부 확인 
	int year = 0; // 입력 연도 

	cin >> year;
	
	if (year>=1 and year<=4000)
	{
		result = checkLeapYear(year);
		cout << result << endl; 	
	}

	return 0;
}
import sys
input = sys.stdin.readline

fibo_nums = [0, 1]
for i in range(90):
    fibo_nums.append(sum([fibo_nums[-1], fibo_nums[-2]]))
    
n = int(input())
print (fibo_nums[n])

 

import sys
input = sys.stdin.readline

fibo_nums = [0, 1]
for i in range(90):
    fibo_nums.append(sum([fibo_nums[-1], fibo_nums[-2]]))
    
n = int(input())
print (fibo_nums[n])

 

#include <iostream>

using namespace std;

int main(void)
{
	int N = 0;
	
	cin >> N;
	
	if (N>=1 and N<=100000)	
	{
		for (int i=N; i>0; i--)
		{
			cout << i << '\n';
		}
	}
	
	return 0;
}
#include <iostream>

using namespace std;

int main(void)
{
	int N = 0;
	
	cin >> N;
	
	if (N>=1 and N<=100000)
	{
		for (int i=1; i<=N; i++)
		{
			cout << i << '\n';
		}
	}
}
#include <stdio.h>

int main(void)
{
	int N = 0;
	
	scanf("%d", &N);
	
	if (N >= 1 and N <= 9)
	{
		for (int i=1; i<=9; i++)
		{
			printf("%d * %d = %d\n", N, i, N*i);
		}
	}
	
	else
		return 0;
		
	return 0;
}
import sys
T = int(input())
for _ in range(T):
    count, string = sys.stdin.readline().split()
    P = ""
    for s in range(len(string)):
        P += string[s] * int(count)
        if s == len(string) -1:
            print (P)

'Computer Science > 백준 알고리즘' 카테고리의 다른 글

[백준] 2741번 N 찍기 (C++)  (0) 2022.03.16
[백준] 2739번 구구단 (C)  (0) 2022.03.16
[백준] 2588번 곱셈 (C++)  (0) 2022.03.16
[백준] 2581번 소수 (C++)  (0) 2022.03.16
[백준] 2577번 숫자의 개수 (C++)  (0) 2022.03.16

 

#include <iostream>
// 몫과 나머지 계산 + 자연수 길이 구하기 
using namespace std;

int getIntLen(int value)
{
	int count = 0;

	do
	{
		value = int(value/10);
		count++;
	}while(value > 0);
	
	return count;
}


int main(void)
{
	// 세자리 자연수 
	int N1, N2 = 0;
	
	// 자연수 길이
	int L1, L2 = 0; 
	
	// 중간 계산 
	int N3, N4, N5 = 0;
		
	cin >> N1;
	cin >> N2;
	
	L1 = getIntLen(N1);
	L2 = getIntLen(N2);
	
	if (L1 == 3 and L2 == 3)
	{
		N3 = N1 * (N2 % 10);
		N4 = N1 * ((N2 / 10) % 10);
		N5 = N1 * ((N2 / 100));
		
		cout << N3 << endl;
		cout << N4 << endl;
		cout << N5 << endl;
		
		cout << N1 * N2 << endl;
	}
	
	return 0;
}

+ Recent posts