Algo-139_ Blue Bridge Cup _ algorithm training _s01 string (recursive)

Source: Internet
Author: User

The problem description S01 string is initially " 0 " Transform 0 Change to 01 input format 1 integers (0~ +) output format N-transform S01 String Sample input 3 Sample Output 101 data size and conventions 0~

Remember:

The information given by the topic is misleading, so people can't see the law (1 should be "1")

The specific requirements are obtained by looking at the results of the test data (Lll¬ω¬)

That is: the string of n = (n-1 string) + (N-2 string)

AC Code:

1#include <stdio.h>2 #defineMAX 100103 4 /*default 0 is "0" and 1 is "1"*/5 Charans[ -][max] = {{"0"},{"1"},};6 voiddgintx)7 {8     if(X <2)9     {Ten         return ;  One     }          ADG (X-1); -     /*the current S01 string is a combination of the first two strings*/ -sprintf (Ans[x],"%s%s", ans[x-2],ans[x-1]); the     return ; - } -  - intMainvoid) + { -     intN; +scanf"%d",&n); A DG (n); atprintf"%s", Ans[n]); -     return 0; -}

Algo-139_ Blue Bridge Cup _ algorithm training _s01 string (recursive)

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.