考输出
来源:互联网 发布:淘宝天猫卷怎么抢到 编辑:程序博客网 时间:2024/05/17 02:00
http://codeforces.com/contest/219/problem/A
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main()
{
int k,a[30];
char s[1024];
cin>>k>>s;
memset(a,0,sizeof(a));
int len= strlen(s);
for(int i=0; i<len; i++)
a[s[i]-'a']++;
for(int i=0; i<26; i++)
{
if(a[i]%k)
{
cout<<-1<<endl;
return 0;
}
}
for(int i=0; i<k; i++)
{
for(int j=0; j<26; j++)
{
for(int l=0; l<a[j]/k; l++)
{
cout<<char(j+'a');
}
}
}
cout<<endl;
return 0;
}
- 考输出
- 考你一个输出“Hello World”程序
- 考
- 考
- 唉,PPLIVE考了个输出自己本身代码的程序
- 考完了
- 考完了
- 考驾照
- 考俟
- 软考
- 考IQ
- 理论考
- 考高程
- 考完了
- 软考
- 考完了
- 软考
- 软考
- IBM部门介绍:研发部(R&D)【CDL、CRL、CSTL】
- LCD的接口类型详解
- linux 下通过修改内核参数解决大量TIME_WAIT问题
- 一个关于RNA-Seq分析方法的投票
- android AP 热点介绍 和接口使用
- 考输出
- HBase中的奇怪问题之LeaseException
- Nginx防盗链详细解说
- destoon如何去掉后台左边菜单我的面板里面的使用帮助
- 查询外部表报错ORA-29913 ORA-29400
- 【Record】【read coding】
- arm-linux apache
- [Unity3D]手机3D游戏开发:如何实现最高分的存储与显示(二)----使用GUI.Box显示文字
- 《C语言深度解培》读书笔记之四