ACdream 之ACfun 题解
A - ACfun
Problem Description
This problem is about "AC".
One day, I write a long string S on the paper which contains "A" and "C". Now I want to find a lexicographic minimum string T satisfied that T is distinct with all substring of S.
Input
In each test case:
Input a string S consist of "A" and "C". The length of S is not large than 100.
Output
You should output the string T meet the condition.
Sample Input
1
ACAC
Sample Output
AA
大致意思就是,找出最长连续的A的数目num然后再输出num+1个A,题目我是没看出来有说这个东西。仅仅是看队友A了问了才知道的,希望ACdream以后出题能考虑到这点吧
代码:
/*
* this code is made by chaoyueziji
* Problem: 1125
* Verdict: Accepted
* Submission Date: 2014-07-11 22:56:21
* Time: 0MS
* Memory: 1676KB
*/
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int main()
{
char s[1001];
int i,j,k,l,t;
int sum,max;
cin>>t;
getchar();
while(t--)
{
sum=max=0;
gets(s);
for(i=0;i<strlen(s);i++)
{
if(s[i]=='A')
{ sum=1; for(j=i+1;j<strlen(s);j++)
{
if(s[i]==s[j])
sum++;
if(sum>max)
max=sum;
if(s[i]!=s[j])
{
sum=1;
break;
}
}
}
}
for(i=0;i<=max;i++)
printf("A");
printf("\n");
}
return 0;
}
ACdream 之ACfun 题解的更多相关文章
- ACdream: ACfun
ACfun Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisti ...
- ACdream原创群赛(18)のAK's dream题解
只做了4题水题ADGI A题需要注意的就是“[...]”的输出了,何时输出,何时不输出. #include <stdio.h> int main() { int n, cur, d; ; ...
- ACdream区域赛指导赛之手速赛系列(5) 题解
A - Problem A Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submi ...
- ACdream 1195 Sudoku Checker (数独)
Sudoku Checker Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & %llu Submit ...
- ACdream 1112 Alice and Bob(素筛+博弈SG函数)
Alice and Bob Time Limit:3000MS Memory Limit:128000KB 64bit IO Format:%lld & %llu Submit ...
- ACdream 1726 A Math game (dfs+二分)
http://acdream.info/problem?pid=1726 官方题解:http://acdream.info/topic?tid=4246 求n个数里面能不能选一些数出来让它们的和等于k ...
- ACdream 1735 输油管道 (排序)
http://acdream.info/problem?pid=1735 官方题解:http://acdream.info/topic?tid=4246 因为主干线是平行于x轴的直线,那么跟x坐标其实 ...
- cdoj 03 BiliBili, ACFun… And More! 水题
Article Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...
- acdream 1738 世风日下的哗啦啦族I 分块
世风日下的哗啦啦族I Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acdream.info/problem?pid=1738 Descri ...
随机推荐
- Windows DIB文件操作具体解释-5.DIB和调色板
Windows调色板是256色显卡时期的产物,如今显卡最少也是16bit的了.所以调色板基本上是用不到了的. 可是以下几种情况还是须要去使用和了解调色板: 1.在新显卡上保证256色兼容模式的正常执行 ...
- python基础教程_学习笔记1:序列-1
序列 数据结构:通过某种方式组织在一起的数据元素的集合,这些数据元素能够是数字或者字符,甚至能够是其它数据结构. python中,最主要的数据结构是序列. 序列中的每一个元素被分配一个序号--即元素的 ...
- Delphi数组复制(只能使用System单元的Move函数)
const AA : arrary[..] ,,,,) var BB : arrary[..] of byte; begin BB := AA ; {这样是错误的} Move(AA,BB,sizeof ...
- Delphi主窗口任务栏菜单的问题(转发WM_SYSCOMMAND到Application)
Delphi的VCL框架在创建应用时TApplication是一个自动创建的隐藏窗口,其它创建的窗口是自动以该窗口为窗口,这就导致创始的主窗口在任务栏的系统菜单只有三项,只要在主窗口的Create事件 ...
- 2cifang.com_2次方学习
2cifang.com_2次方学习
- 使用Jquery+EasyUI项目开发情况的框架是中评---员工管理源代码共享
使用Jquery+EasyUI 进行框架项目开发案例解说之中的一个 员工管理源代码分享 在開始解说之前,我们先来看一下什么是Jquery EasyUI?jQuery EasyUI是一组基于jQuery ...
- thinkphp3.2入口文件
原文:thinkphp3.2入口文件 <?php define('DIR_SECURE_FILENAME', 'default.html');//错误页面 define('APP_PATH',' ...
- 千万别用模板给的list.size()巨坑
要用!list.empty()取代i<list.size();否则就不会AC了.
- java中线程中的相关知识点
(1)守护线程必须在线程start前设置(2)守护线程在所有用户线程结束后,也会终止(3)由于(2)所有守护线程不能执行一些读写操作,原因:如果守护线程在执行读写操作时,如果用户线程结束了,守护线程的 ...
- Invalid embedded descriptor for ".proto".Dependencies passed (Protobufer)解决办法
前言 之前开发的时候,发现居然出现了Dependencies passed to FileDescriptor.buildFrom() don't match those listed in the ...
