인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

suyeonkoo's profile image
suyeonkoo

asked

Introduction to Algorithm Problem Solving for IT Employment (with C/C++): Coding Test Preparation

13. Most used digits

13번 0점...

Written on

·

240

0

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.

 

#include <iostream>

int arr[10];

int main()

{

//freopen("input.txt.txt","rt",stdin);

char num[101];

int i;

int tmp;

int max = 0;

int Smax;

scanf("%s", &num);

for(i=0; num[i]!= '\0'; i++)

{

tmp = num[i] - 48;

arr[tmp]++;

}

for(i=0; i<10; i++)

{

if(arr[i]>=max)

{

max = arr[i];

Smax = i;

}

}

printf("%d\n",Smax);

return 0;

}

 

왜 빵점만 나오는 거죠? 어디가 틀린 건가요ㅠㅠ?

c++코딩-테스트

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

제 컴퓨터에서는 100점이 나옵니다.

suyeonkoo님의 프로필 이미지
suyeonkoo
Questioner

아하 감사합니다ㅠㅠ!

suyeonkoo's profile image
suyeonkoo

asked

Ask a question