1. Title Description: Click to open the link
2. Problem-Solving ideas: The question is essentially asking: given a string long as L, select a character in 26 characters to insert the string, how many new strings can be formed. This is a simple counting problem, the length of the string of L l+1 can be inserted, there is a total of 26* (l+1) method, considering the case of the same character, to subtract one, altogether there is a case of l repetition, so finally there is 26* (l+1)-l=25* (l+1) + 1 cases.
3. Code:
#define _crt_secure_no_warnings#include<iostream> #include <algorithm> #include <string> #include <sstream> #include <set> #include <vector> #include <stack> #include <map> #include < queue> #include <deque> #include <cstdlib> #include <cstdio> #include <cstring> #include < cmath> #include <ctime> #include <functional>using namespace std;typedef long Long ll;typedef unsigned Long long ull; #define ME (s) memset (s,0,sizeof (s)) #define for (i,n) for (int i=0;i< (n); i++) #define PB Push_back#define SZ size#define CLR Clear#define F (A, b) for (int i=a;b;i++) int main () { string s; while (Cin>>s) { int len=s.length (); int ans= (len+1) *25+1; printf ("%d\n", ans); } return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
#309 (Div.2) A. Kyoya and Photobooks