본문 바로가기

Programming/Algorithm

[C++]백준 2577번 : 숫자의 개수

https://www.acmicpc.net/problem/2577


#include <iostream>

#include <string>

using namespace std;


int main() {

int A, B, C;

cin >> A >> B >> C;


int mult = A * B * C;

string multS = to_string(mult);

int len = multS.length();

int number[10] = { 0 };

string num;

for (int i = 0; i < len; i++) {

num = multS[i];

number[stoi(num)]++;

}

for (int j = 0; j < 10; j++) cout << number[j] << '\n';

}

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

[C++]백준 1934번 : 최소 공배수  (0) 2019.02.03
[C++]백준 10039번 : 평균 점수  (0) 2019.02.03
[C++]백준 1152번 :단어의 개수  (0) 2019.02.03
[C++]백준 1065번 : 한수  (0) 2019.02.02
[C++]백준 4673번:셀프 넘버  (0) 2019.02.01