알고리즘
[체감난이도/하]백준 1475번 방 번호
심재철
2017. 8. 28. 22:52
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 | #include <iostream> #include <string> #include <algorithm> using namespace std; int check[10]; int main() { string str; getline(cin, str); for (int i = 0; i < str.size(); i++) { check[str[i] - '0']++; } int maxx = -1; maxx = (check[6] + check[9]) % 2 == 0 ? (check[6] + check[9]) / 2 : (check[6] + check[9]) / 2 + 1; for (int i = 0; i < 10; i++) { if (i == 6 || i == 9) continue; maxx = max(maxx, check[i]); } cout << maxx << endl; return 0; } | cs |