频道栏目
首页 > 资讯 > C++ > 正文

BZOJ 2760 JLOI 2011 小A的烦恼 模拟

14-12-06        来源:[db:作者]  
收藏   我要投稿

题目大意:小A有一些烦恼,现在要求你去给他解决一下。


思路:语法基础题。


CODE:

#include 
#include 
#include 
#include 
#include 
#define MAX 1010
using namespace std;
 
int total,m;
string ans[MAX],name;
int cnt[MAX];
 
int main()
{
    cin >> total;
    for(int num,i = 1; i <= total; ++i) {
        cin >> num >> name;
        ans[0] += name;
        m = max(m,num);
        memset(cnt,0,sizeof(cnt));
        for(int j = 1; j <= num; ++j) {
            string temp;
            cin >> temp;
            ans[j] += temp;
            for(string::iterator it = temp.begin(); it != temp.end(); ++it)
                cnt[j] += *it == ',';
        }
        int _max = *max_element(cnt + 1,cnt + num + 1);
        for(int j = 0; j < MAX; ++j)
            for(int k = cnt[j]; k <= (i == total ? _max - 1:_max); ++k)
                ans[j] += ',';
    }
    for(int i = 0; i <= m; ++i)
        cout << ans[i] << endl;
    return 0;
}

JL的题为什么这么弱!!
相关TAG标签
上一篇:2.Cocos2d-x-3.2编写3d打飞机,项目代码总结
下一篇:Java数据结构系列之——树(6):二叉树的层序遍历
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站