Codeforces554A:Kyoya and Photobooks

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.

Input

The first line of input will be a single string s (1?≤?|s|?≤?20).
String s consists only of lowercase English letters.

Output

Output a single integer equal to the number of distinct photobooks Kyoya Ootori can make.

Sample test(s)

input

a

output

51

input

hi

output

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.

题意:

给出一个字符串,问再加入一个字母,能形成多少种字符串

#include <stdio.h>
#include <string.h>

int main()
{
    char str[100];
    int len;
    scanf("%s",str);
    len = strlen(str);
    printf("%d\n",26*(len+1)-len);

    return 0;
}
时间: 2024-08-09 07:14:30

Codeforces554A:Kyoya and Photobooks的相关文章

cf #309a A - Kyoya and Photobooks

A - Kyoya and Photobooks Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled "a" to "z&

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 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 photo

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

题目传送门 1 /* 2 找规律,水 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <algorithm> 7 #include <cstring> 8 #include <cmath> 9 using namespace std; 10 11 const int MAXN = 1e4 + 10; 12 const int INF = 0x3f3f3f3f; 13 char s

#309 (div.2) A. Kyoya and Photobooks

1.题目描述:点击打开链接 2.解题思路:本题实质上在问:给定一个长为L的字符串,在26个字符中选一个字符插入该串,可以形成多少个新的字符串.这就是一个简单的计数问题,长度为L的字符串有L+1个空位可以插入,一共有26*(L+1)个方法,考虑到相同字符的情况,要减去一个,一共有L种重复的情况,因此最终有26*(L+1)-L=25*(L+1)+1种情况. 3.代码: #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<al

codeforces 553A . Kyoya and Colored Balls 组合数学

Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he

Codeforces554D:Kyoya and Permutation

Let's define the permutation of length n as an array p?=?[p1,?p2,?...,?pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 and so on. Kyota Ootori has ju

CF R309C 554C Kyoya and Colored Balls

554C Kyoya and Colored Balls 即求 复合条件的序列数量 序列最后一位必定是K. 那么对于c[k]-1个剩下的K,有n-1个位置去放置. 同理,对于颜色为k-1的球 在剩下的n-c[k]个位置中,必有一个在最靠右的空位置上. 剩下的c[k-1]-1个球放在剩下的位置上 类推 core code: while(k--){ res *= C[n-1][c[k]-1]%MOD; n -= c[k]; }

codeforces 553 A Kyoya and Colored Balls

这个题,比赛的时候一直在往dp的方向想,但是总有一个组合数学的部分没办法求, 纯粹组合数学撸,也想不到办法-- 其实,很显然.. 从后往前推,把第k种颜色放在最后一个,剩下的k球,还有C(剩余的位置,k球的总数目-1)种放法 然后讨论第k-1种...推下去就好了 但是当时没想到-- 这里要求组合数,由于比较大,用乘法逆元... 当然直接套lucas也是可以的.... time limit per test 2 seconds memory limit per test 256 megabytes

Codeforces 553A. Kyoya and Colored Balls

Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he