zoukankan      html  css  js  c++  java
  • 题解 P1598 【垂直柱状图】

    模拟+字符串

    In fact , 这道题很简单,就是注意(such as 想装一装却不小心把"A"写成了"64" or "66"等等辣鸡错误)细节就可以了,一路扫过去,把所有单词出现的次数记录下来,然后模拟一个输出。

    务必注意空格!!!

    表示特别看好这道题(可以淘汰掉没有耐心的人)太高级怕写不好题解

    至于输出,是同学们的礼物。

    标程奉上


    #include<bits/stdc++.h>
    
    using namespace std;
    
    int word[30];
    string a;
    int i,j,k;
    int maxx=-1;//最爱的储存方式
    int main()
    {
    	while(cin>>a)
    	{
    		for(k=0;k<a.length();k++)
    		{
    			if(a[k]>='A'&&a[k]<='Z')
                {
                	word[a[k]-'A']++;
                }
    		}
    	}//蒟蒻的输入方式
    	for(i=0;i<26;i++)
    	{
    		maxx=max(maxx,word[i]);
    	}
    	for(i=maxx;i;i--)
        {  
            for(j=0;j<26;j++)
            {
            	if(word[j]>=i)
            	{
            		printf("* ");
            	}
            	else printf("  ");
            }
            printf("
    ");
        }
        for(int i=0;i<26;i++)
        {
            putchar(i+'A');
            if(i!=25)putchar(' ');
        }//乱搞一通的输出,仔细看看就好
    }
    

    人生的路,走走停停是一种闲适,边走边看是一种优雅,边走边忘,是一种豁达。何必把自己逼得那么累,埋着头赶路,路到尽头,却错过了乐趣,错过了精彩。不如一边追求,一边享受。你认为快乐的,就去寻找;你认为值得的,就去守候;你认为幸福的,就去珍惜。做最真实最漂亮的自己,依心而行,无憾今生。

    The road of life, walking and stopping is a kind of leisurely, walking along the side to see is a kind of elegance, side by side forget, is a kind of open-minded. Why do you have to make yourself so tired, bury your head and go to the end of the road, but miss the fun and miss the wonderful. It's better to pursue and enjoy. When you think you are happy, look for it; you think it is worth it. Do the most true and the most beautiful, go through the heart, without regrets this life.

    人生の道を歩いて、停止は一種ののどかで、歩きながらは優雅で、歩きながら忘れて、1種の闊達。なぜ自分を追いつめてそんなに疲れて、沒頭して急いで、道の果てに、逃した楽しみを逃したが、素晴らしい。むしろを求めながら、楽しみながら。あなたは楽しい、探しに行きます;あなたに値するのと、待って;あなたは幸せを大切にし。最も真実が最もきれいな自分、依心行、人生に悔いなし。

  • 相关阅读:
    J2ME学习笔记之问题看法
    单词王(kingWord)
    TCP的粘包和拆包问题及解决办法(C#)
    vuex里mapState,mapGetters使用详解
    agelform formcreate 使 elementui form 组件更简单
    elementui 二次封装系列 button
    开源一套后台管理系统框架,远离996 记录
    客户端架构介绍
    简单的Unity学习项目,封装了一下简单、通用功能组件,适用于数据可视化展示
    Vue关于对象数组的双向数据绑定(props与watch)
  • 原文地址:https://www.cnblogs.com/XSZCaesar/p/10549531.html
Copyright © 2011-2022 走看看