码迷,mamicode.com
首页 > 其他好文 > 详细

1047 Student List for Course (25 分)

时间:2021-02-19 12:59:54      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:log   string   scanf   www   vector   get   _id   can   tor   

兄弟题1039 Course List for Student (25 分),一样很水。

vector<string> course[2510];
int n,m;

int main()
{
    cin>>n>>m;

    for(int i=0;i<n;i++)
    {
        string name;
        name.resize(4);
        int k;
        scanf("%s %d",&name[0],&k);

        for(int j=0;j<k;j++)
        {
            int course_id;
            scanf("%d",&course_id);
            course[course_id].pb(name);
        }
    }

    for(int i=1;i<=m;i++)
    {
        printf("%d %d\n",i,course[i].size());
        sort(course[i].begin(),course[i].end());
        for(int j=0;j<course[i].size();j++)
            printf("%s\n",course[i][j].c_str());
    }
    //system("pause");
    return 0;
}

1047 Student List for Course (25 分)

标签:log   string   scanf   www   vector   get   _id   can   tor   

原文地址:https://www.cnblogs.com/fxh0707/p/14408454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!