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 ...
随机推荐
- 可能性dp+减少国家HDU4336
Card Collector Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Subm ...
- SQL中EXISTS的用法(转)
比如在Northwind数据库中有一个查询为SELECT c.CustomerId,CompanyName FROM Customers cWHERE EXISTS(SELECT OrderID FR ...
- android studio 9.png 报错
Eclipse里能正常运行,但是导入到Android Studio里就报如下的错误 百度了下,说有两种解决办法一种是改后缀名,还有一种是重新在Android Studio里画一下点9图片.但是这个项目 ...
- CURD特性
本节课大纲: 一.ThinkPHP 3 的CURD介绍 (了解) 二.ThinkPHP 3 读取数据 (重点) 对数据的读取 Read $m=new Model('User'); ##返回一个实例 $ ...
- Windows调试工具入门—1
NetRoc http://www.DbgTech.net 引子 Debugging Tools for Windows是微软发布的一套用于软件调试的工具包(后面如果没有指明,那么我会使用WinDbg ...
- 开启程序的Visual Styles
首先看看MS对Visual Styles的解释: Windows XP and later operating systems support a feature called visual styl ...
- 简单深刻:为控件创建MouseEnter和MouseLeave事件(覆盖WndProc,增加对消息的处理,真简单!)——连对CM_MOUSEENTER的消息处理都是颇有深意啊!
其实很简单: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, D ...
- 给工程师的 10 条哲理(浅薄者迷信运气,强者相信因果,软件复制成本为零,文凭不重要,AWS使得创业成本为零,每个手机都是口袋里的强大电脑)
无论是主题分布式数据库,微服务,Soylent,尤伯杯,或者矮人要塞,我们试图从物质分离出来炒作,推迟叙事的客人.与尊重有软件工程日报的社论部分客观性. 一位渠道的成员说,“当软件工程每日的意见公布, ...
- js技术要点---JS 获取网页源代码
JS 获取网页源代码 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html& ...
- IOS-UITextField-邮箱后缀联想赛
最近做的项目,有一个函数,百度了一下 结果没 要研究了一下. 当用户输入邮箱形式的账号时,输入完"@"符号后.联想出经常使用的邮箱 点击某一行,将改行代表邮箱自己主动输入到账号输入 ...
