2577 숫자의 개수

Console/Algorithm 2019. 10. 15. 21:44
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = a * b * c;
            string e = Convert.ToString(d);
            int[] count = new int[10];
            int[] f = new int[e.Length];
            for (int i = 0; i < e.Length; i++)
            {
                f[i] = int.Parse(e[i].ToString());
            }
            for (int j = 0; j < count.Length; j++)
            {
                for (int k = 0; k < e.Length; k++)
                {
                    if (f[k] == j)
                    {
                        count[j]++;
                    }
                }
            }
            for (int l = 0; l < count.Length; l++)
            {
                Console.WriteLine(count[l]);
            }
        }
 
    }
 
}
 
 
 
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
 

'Console > Algorithm' 카테고리의 다른 글

1546 평균  (0) 2019.10.15
2739 구구단  (0) 2019.09.30
10817 세수  (0) 2019.09.28
2753 윤년  (0) 2019.09.27
1330 두 수 비교하기  (0) 2019.09.27