티스토리 뷰
백준 1475번
문제 사이트 :
https://www.acmicpc.net/problem/1475
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
#define Max 11
int Array[Max];
int main(void) {
int input;
scanf("%d", &input);
if (input) {
int num = log10(input) + 1;
for (int i = 0; i < num; i++) {
int index = input % 10;
if (index == 6 || index == 9) {
Array[6]++;
}
else {
Array[input % 10]++;
}
input = input / 10;
}
int max = 0;
for (int i = 0; i < 10; i++) {
if (i == 6) {
if (max < Array[6] / 2 + Array[6] % 2) {
max = Array[i] / 2 + Array[6] % 2;
}
}
else {
if (max < Array[i]) {
max = Array[i];
}
}
}
printf("%d", max);
}
else {
printf("1");
}
return 0;
}
'PS > 백준' 카테고리의 다른 글
| 10989번 수 정렬하기 3 (0) | 2019.06.27 |
|---|---|
| 2750번 수 정렬하기 (0) | 2019.06.27 |
| 10250번 ACM 호텔 (0) | 2019.06.24 |
| 2775번 부녀회장이 될테야 (0) | 2019.06.24 |
| 1193번 분수찾기 (0) | 2019.06.24 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 부스트코스
- UIView
- storage
- HumanInterfaceGuidelines
- MVC
- Human Interface Guideline
- 알고리즘
- 분할정복
- Firebase
- 싱글톤
- 백준
- 오토레이아웃
- apple
- Human Interface Guidelines
- HIG
- 온라인저지
- DP
- ios
- 디자인패턴
- Swift
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함
