Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks【*组合数学】
2 seconds
256 megabytes
standard input
standard output
Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled "a" to "z", and he has compiled them into a photo booklet with some photos in some order (possibly with some photos being duplicated). A photo booklet can be described as a string of lowercase letters, consisting of the photos in the booklet in order. He now wants to sell some "special edition" photobooks, each with one extra photo inserted anywhere in the book. He wants to make as many distinct photobooks as possible, so he can make more money. He asks Haruhi, how many distinct photobooks can he make by inserting one extra photo into the photobook he already has?
Please help Haruhi solve this problem.
The first line of input will be a single string s (1 ≤ |s| ≤ 20). String s consists only of lowercase English letters.
Output a single integer equal to the number of distinct photobooks Kyoya Ootori can make.
a
51
hi
76
In the first case, we can make 'ab','ac',...,'az','ba','ca',...,'za', and 'aa', producing a total of 51 distinct photo booklets.
【题意】: 给一个长度不大于20的字符串。任意一个位置插入一个a-z 。求一共有多少新字符串的可能。
【分析】:长度为n的字符串 有n+1个空位。第一个位置有26种。剩下的位置, 只需要和前一个位置避免重复就好,所以都是25种。所以答案就是26+25*n。
【代码】:
#include <bits/stdc++.h>
using namespace std; char a[25];
int main()
{
int n;
scanf("%s",a);
n=strlen(a);
printf("%d\n",n*25+26);
}
Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks【*组合数学】的更多相关文章
- 找规律 Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks
题目传送门 /* 找规律,水 */ #include <cstdio> #include <iostream> #include <algorithm> #incl ...
- Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks 字符串水题
A. Kyoya and Photobooks Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- Codeforces Round #309 (Div. 1) B. Kyoya and Permutation 构造
B. Kyoya and Permutation Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...
- Codeforces Round #309 (Div. 2) C. Kyoya and Colored Balls 排列组合
C. Kyoya and Colored Balls Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contes ...
- Codeforces Round #309 (Div. 2) -D. Kyoya and Permutation
Kyoya and Permutation 这题想了好久才写出来,没看题解写出来的感觉真的好爽啊!!! 题目大意:题意我看了好久才懂,就是给你一个序列,比如[4, 1, 6, 2, 5, 3],第一个 ...
- Codeforces Round #309 (Div. 2) C. Kyoya and Colored Balls
Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are ...
- 贪心 Codeforces Round #309 (Div. 2) B. Ohana Cleans Up
题目传送门 /* 题意:某几列的数字翻转,使得某些行全为1,求出最多能有几行 想了好久都没有思路,看了代码才知道不用蠢办法,匹配初始相同的行最多能有几对就好了,不必翻转 */ #include < ...
- A. Kyoya and Photobooks(Codeforces Round #309 (Div. 2))
A. Kyoya and Photobooks Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He ...
- Codeforces Round #309 (Div. 2)
A. Kyoya and Photobooks Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He ha ...
随机推荐
- Chapter 6 排序
Chapter 6 排序 1- 直接插入排序 O(n2) O(1) 2- 折半插入排序 O(n2) O(1) 适合关键字较多 3- 希尔排序O(nlogn) O(1) 又名,缩小增量排序 ...
- 深度学习(二十六)Network In Network学习笔记
深度学习(二十六)Network In Network学习笔记 Network In Network学习笔记 原文地址:http://blog.csdn.net/hjimce/article/deta ...
- JZOJ5883【NOIP2018模拟A组9.25】到不了——动态LCA裸题
题目描述 Description wy 和 wjk 是好朋友. 今天他们在一起聊天,突然聊到了以前一起唱过的<到不了>. "说到到不了,我给你讲一个故事吧." &quo ...
- ionic Hide tabs 实现
1.指令代码 directiveMod.directive('hideTabs',function($rootScope){ return { restrict:'AE', link:function ...
- layer时间插件
引入: <link rel="stylesheet" href="<{$cdnsite}>/default/common/layui/css/layui ...
- windows下docker 启动jenkins成功,浏览器无法访问,拒绝了我们的连接
[问题现象] 在Windows下使用docker启动了一个jenkins,翻越了无数的坑,最后的启动命令为 docker run --name jenkins -u root -p 8000:8000 ...
- 第三方博客同步xmlrpc、rest、API等相关的文章网址记录
http://answers.microsoft.com/en-us/windowslive/forum/writer-wlsettings/i-am-encountering-a-problem-s ...
- SpringCloud微服务实战三:Hystix的基本概念
1.说到隔离.熔断.降级,最出名的就是 Netflix 开源的 Hystrix 组件,Hystix官方对它描述为:Hystrix是一个延迟和容错库,旨在隔离远程系统.服务和第三方库,阻止级联故障,在复 ...
- CImage 是基于GDI+的,很老的一篇文章,我很久很久以前看到过的
在许多资料上都说CImage类是基于GDI+的,但是为什么是基于GDI+的呢? 因为使用这个类时,并没有加入#include <gdiplus.h> ,也没有在程序开始和结束时分别写GDI ...
- 一、WebService基础概念
一.Web Service简介 1.1.Web Service基本概念 Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intrane ...