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 ...
随机推荐
- QC的安装和配置
QC(Quality center)的安装配置 Wmware 虚拟机 数据库SQL server2000 Windows server 2003 须安装数据库的sp4补丁包 注意事项 数据库安装时选择 ...
- 周期串Uva455 P37 3-4
A character string is said to have period k if it can be formed by concatenating one or more repetit ...
- mysql工具使用
mysql -u user_name -p123456 -h host_name -P 3306 -D database_name -e "show full processlist;&qu ...
- Kubernetes集群环境准备
目录 二.准备工作 主机名 IP地址(NAT) 描述 linux-node1.example.com eth0:192.168.56.11 Kubernets Master节点/Etcd节点 li ...
- HTML5移动开发中的input输入框类型 (转)
公司的项目开发过程中的,的用户体验忽略了.登录tel就用tel属性.新来的小伙伴提醒的.谢谢他 数字类型number 定义input类型为type="number"时,iOS显示数 ...
- CSS3 进阶
background-clip指定了背景可以覆盖到什么范围.background-origin指定了背景从什么位置开始.在例子中设置背景平铺应该可以看得清楚些. CSS3之前的背景,按规定是不会进入到 ...
- 关于CSS3 animation 属性在ie edge浏览器中不能工作
我想要给div边框加一个闪烁,所以我将css中设置如下 给想要闪烁的div加上blink类 这样在firefox,chrome下是正常显示的,但是在ie下box-shadow属性不能被正常的展现 后 ...
- (转载)关于My97 datepicker与Angular ng-model绑定问题解决。
转载自 http://zerosoft.blog.51cto.com/679447/1611403 <input type="text" ng-model="d&q ...
- xcode下的DerivedData
在模拟器运行的情况下经常会出现以下的错误: error: remove /Users/mac/Library/Developer/Xcode/DerivedData/YuQing-amkrrucjrn ...
- 转: V4L2驱动程序架构
源地址:http://blog.chinaunix.net/uid-26101960-id-3297657.html 1 V4L2简介 video4linux2(V4L2)是Linux内核中关于视频设 ...