출제 링크 : https://www.acmicpc.net/problem/2577
2577번: 숫자의 개수
첫째 줄에 A, 둘째 줄에 B, 셋째 줄에 C가 주어진다. A, B, C는 모두 100보다 크거나 같고, 1,000보다 작은 자연수이다.
www.acmicpc.net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Solution
{
class Program
{
static void Main(string[] args)
{
int num = 3;
int[] input_Num = new int[num];
int result=1;
int count = 0;
//AxBxC의 값
for(int i=0; i<num; i++)
{
input_Num[i] = int.Parse(Console.ReadLine());
result *= input_Num[i];
}
//곱한 결과를 char형으로 하나하나 변환
char[] pieceNum = result.ToString().ToCharArray();
//pieceNum의 값을 분석
for(int i=0; i<10;i++)
{
for(int j=0;j<pieceNum.Length;j++)
{
if(pieceNum[j].ToString() == i.ToString())
{
count++;
}
}
Console.WriteLine(count);
count = 0;
}
}
}
}
'Baekjoon 문제풀이' 카테고리의 다른 글
[Baekjoon 5단계(2)] 2562번 : 최댓값 (0) | 2021.09.02 |
---|---|
[Baekjoon 5단계(1)] 10818번 : 최소, 최대 (0) | 2021.09.01 |
[Baekjoon 4단계(3)] 1110번 : 더하기 사이클 (0) | 2021.09.01 |
[Baekjoon 4단계(2)] 10951번 : A+B - 4 (0) | 2021.09.01 |
[Baekjoon 4단계(1)] 10952번 : A+B - 5 (0) | 2021.08.31 |