zoukankan      html  css  js  c++  java
  • Codeforces Round #230 (Div. 2) 解题报告

    Problem A. Nineteen

    思路: 除了首位像连的n,其他的字母不能共用nineteenineteen。所以可以扫描一遍所有的字符串将出现次数保存到hash数组,n的次数(n - 1) / 2,e为e / 3。最小值就是min(i, e / 3, t , (n - 1) / 2)。

    #include <cstdio>
    #include <algorithm>
    
    int main() {
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
        char c;
        int h[256] = {0};
        while (scanf("%c", &c) != EOF && c != '
    ') {
            h[c]++;
        }
        int sum = h['e'] / 3;
        sum = std::min(sum, h['i']);
        sum = std::min(sum, h['t']);
        sum = std::min(sum, (h['n'] - 1) / 2);
        printf("%d
    ", sum);
        return 0;
    }
    View Code
    总想把每一篇文章精雕细琢之后以完美的面貌示人,就像演员在演出前都要彩排,总想准备好之后再去展现精彩的一面,但人生的每一刻都是精彩的,就算现在还不完善也要发出来,作为自己一直在学习的一种见证。
  • 相关阅读:
    数据结构杂谈(三)堆排序
    数据结构杂谈(二)简单有趣的地精排序Gnome sort
    搭建proftp服务器
    python 单例模式
    mongo
    kafka
    查看端口占用
    tinyproxy 代理使用
    Linux 搭建wiki
    linux 安装 java
  • 原文地址:https://www.cnblogs.com/fripside/p/3556548.html
Copyright © 2011-2022 走看看