A - ACfun

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

题目链接点击打开链接
As a former ACMer, "AC" is a special abbreviated word which can bring much pleasure to me. Sometimes it means everything.

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

The first line of input file contains an integer T indicating the number of case.

In each test case:

Input a string S consist of "A" and "C". The length of S is not large than 100.

Output

For each test case:

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 题解的更多相关文章

  1. ACdream: ACfun

    ACfun Time Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisti ...

  2. ACdream原创群赛(18)のAK's dream题解

    只做了4题水题ADGI A题需要注意的就是“[...]”的输出了,何时输出,何时不输出. #include <stdio.h> int main() { int n, cur, d; ; ...

  3. ACdream区域赛指导赛之手速赛系列(5) 题解

    A - Problem A Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submi ...

  4. ACdream 1195 Sudoku Checker (数独)

    Sudoku Checker Time Limit:1000MS     Memory Limit:64000KB     64bit IO Format:%lld & %llu Submit ...

  5. ACdream 1112 Alice and Bob(素筛+博弈SG函数)

    Alice and Bob Time Limit:3000MS     Memory Limit:128000KB     64bit IO Format:%lld & %llu Submit ...

  6. ACdream 1726 A Math game (dfs+二分)

    http://acdream.info/problem?pid=1726 官方题解:http://acdream.info/topic?tid=4246 求n个数里面能不能选一些数出来让它们的和等于k ...

  7. ACdream 1735 输油管道 (排序)

    http://acdream.info/problem?pid=1735 官方题解:http://acdream.info/topic?tid=4246 因为主干线是平行于x轴的直线,那么跟x坐标其实 ...

  8. cdoj 03 BiliBili, ACFun… And More! 水题

    Article Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...

  9. acdream 1738 世风日下的哗啦啦族I 分块

    世风日下的哗啦啦族I Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acdream.info/problem?pid=1738 Descri ...

随机推荐

  1. Android动态布局,并动态为TextView控件设置drawableLeft、drawableRight等属性加入图标

    注:(图中每个条目和图标都是由代码动态生成) 代码动态布局,并须要为每个条目设置图标,此时用到了 android:drawableLeft="@drawable/icon"  父x ...

  2. Swift - 文本标签(UILabel)的用法

    1,标签的创建 1 2 3 4 5 6 7 8 9 10 import UIKit class ViewController: UIViewController {     override func ...

  3. 《Getting Started with WebRTC》第一章 WebRTC介绍

    <Getting Started with WebRTC>第一章 WebRTC介绍 ​ 本章是对WebRTC做概念性的介绍. 阅读完本章后.你将对下面方面有一个清晰的理解:   .  什么 ...

  4. STL 源代码分析 算法 stl_algo.h -- includes

    本文senlie原,转载请保留此地址:http://blog.csdn.net/zhengsenlie includes(应用于有序区间) ------------------------------ ...

  5. 解压tar.gz文件报错gzip: stdin: not in gzip format解决方法

    解压tar.gz文件报错gzip: stdin: not in gzip format解决方法 在解压tar.gz文件的时候报错 1 2 3 4 5 [Sun@localhost Downloads] ...

  6. 理解 Python 中的线程

    原地址:http://blog.jobbole.com/52060/ 本文由 伯乐在线 - acmerfight 翻译自 Akshar Raaj.欢迎加入技术翻译小组.转载请参见文章末尾处的要求. 我 ...

  7. HOG算子

    原地址:http://blog.csdn.net/chlele0105/article/details/11991533 梯度直方图特征(HOG) 是一种对图像局部重叠区域的密集型描述符,它通过计算局 ...

  8. JavaScript 中的事件类型3(读书笔记思维导图)

    Web 浏览器中可能发生的事件有很多类型.如前所述,不同的事件类型具有不同的信息,而“ DOM3级事件”规定了以下几类事件. UI(User Interface,用户界面)事件:当用户与页面上的元素交 ...

  9. POJ 3267-The Cow Lexicon(DP)

    The Cow Lexicon Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8252   Accepted: 3888 D ...

  10. iOS安全攻击和防御(24):敏感的保护方案逻辑(1)

    iOS安全攻击和防御(24):敏感的保护方案逻辑(1) Objective-C代码easy被hook.暴露信息太赤裸裸,为了安全,改用C来写吧! 当然不是所有代码都要C来写,我指的是敏感业务逻辑代码. ...