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 ...
随机推荐
- 设置苹果手机input按钮和button按钮颜色显示问题
网页上,尽管设置了input按钮和button的背景颜色,但在苹果手机上测试时仍会发现背景颜色为透明渐变色,不起作用,怎么解决呢? 在css公共样式中加上下面代码就可以解决,去除button和inpu ...
- python-web-selenium模拟控制浏览器
用 selenium 模块控制浏览器 启动 selenium 控制的浏览器 from selenium import webdriver brower = webdriver.Firefox() br ...
- bootstrap-select 插件示例
本文原创地址:http://www.cnblogs.com/landeanfen/p/7457283.html 一.组件开源地址以及API说明 bootstrap-select开源地址:https ...
- gitlab不支持mysql,这就是我学习PostgreSQL的原因
Gitlab 官方宣布,将从 12.1 版本开始不再支持 MySQL 数据库.早在 2017年7月,Gitlab 就计划将弃用对 MySQL 的支持.而目前这个决定将从 12.1 版本开始. 编辑注: ...
- leetcode 1078 Occurrences After Bigram
lc1078 Occurrences After Bigram trim().split()将原字符串转换成words数组 依次匹配first和second,若两者都能匹配上,则下一个单词为third ...
- spring cloud深入学习(十一)-----服务网关zuul
前面的文章我们介绍了,Eureka用于服务的注册于发现,Feign支持服务的调用以及均衡负载,Hystrix处理服务的熔断防止故障扩散,Spring Cloud Config服务集群配置中心,似乎一个 ...
- 安装配置flask环境
安装 Flask 好的,让我们开始吧! 现在我们必须开始安装 Flask 以及一些我们会用到的扩展.我首选的方式就是创建一个虚拟环境,这个环境能够安装所有的东西,而你的主 Python 不会受到影响. ...
- C#——找出实现某个接口的所有类 - Hello World - CSDN博客
原文:C#--找出实现某个接口的所有类 - Hello World - CSDN博客 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u0125260 ...
- js 事件的自定义函数
转自:http://www.zhangxinxu.com/study/201203/js-custom-dom-events.html http://stylechen.com/trigger.htm ...
- git pull拉取远程分支时出现冲突
现象:在git clone一个项目后,默认是master分支,但是如果想要切换到另一个已经存在的dev分支,那么不要先在本地创建dev分支再拉取远程的dev分支,而是应该直接切换到dev分支,然后再拉 ...