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

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.