Codeforces Round #309 (Div. 2)A. Kyoya and Photobooks

A. Kyoya and Photobooks

time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard 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.
翻译:
京雅·奥托里正在出售乌兰高中寄宿俱乐部的相册。他有26张照片,标有"a"到"z",他把它们汇编成一本相册,上面有一些照片(可能有些照片被复制)。相册可称为一串小写字母,按顺序由小册子中的照片组成。他现在想卖一些"特别版"相册,每本相册上都插着一张额外的照片。他想制作尽可能多的不同的相册,这样他就能赚更多的钱。他问Haruhi,他可以通过在已经拥有的相册中插入一张额外的照片来制作多少种不同的相册?

Input

The first line of input will be a single string s (1 ≤ |s| ≤ 20). String s consists only of lowercase English letters.
翻译:
输入的第一行将是单个字符串s (1 ≤ |s| ≤ 20)。字符串仅由小写英语字母组成。

Output

Output a single integer equal to the number of distinct photobooks Kyoya Ootori can make.
翻译:
输出一个整数等于 Kyoya Ootori 可以制作的独特相册的数量。

Examples

inputCopy

a

outputCopy

51

inputCopy

hi

outputCopy

76

Note
In the first case, we can make ‘ab’,‘ac’,…,‘az’,‘ba’,‘ca’,…,‘za’, and ‘aa’, producing a total of 51 distinct photo booklets.

解题思路

1、输入字符,计算长度,在草稿本上陈列可能出现的情况
2、字符重复的次数
在这里插入图片描述

参考代码

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main()
{
    
    
	string s;
	cin>>s;
	int len=s.length();
	cout<<26*(len+1)-len<<endl;
	return 0;
}

没明白的话,欢迎来打扰;
学会了的话,留下一个赞,互相鼓励哦!!!

猜你喜欢

转载自blog.csdn.net/weixin_45950429/article/details/113926870
今日推荐