1254 Problem V

Source: Internet
Author: User

Question V: yy time limit for Bachelor: 1 Sec memory limit: MB submitted: 22 [Submit] [status] [discussion version] Title Description

YY often meet a strange thing, whenever he sees time, always see 11:11, this is very tangled ah.

Now give you M 1, you can put 2 1 groups to synthesize a 2, so it is not a bachelor, ask such a combination how many kinds??

For example (111 can be split into 111 12 21 with three types)

Input

The first line inputs an n to indicate that there are n test data for the following n rows, each line input M 1 (1 <= n,m <= 200)

Output

Output This combined seed number, one row

Sample input
31111111111
Sample output
238

The problem is actually asking for the first 200 Fibonacci series + Large Numbers


1#include <iostream>2#include <string.h>3 using namespacestd;4 5 Chara[222];6 inttag;7 intf[222][1111],t;8 9 voidFB ()Ten { One     inti,j; AMemset (F,0,sizeof(f)); -f[0][0]=f[1][0]=1; -      for(i=2;i<222; i++) the     { -tag=0; -          for(j=0; j<= $; j + +) -         { +tag=f[i-1][j]+f[i-2][j]+tag; -f[i][j]=tag%Ten; +Tag/=Ten; A         } at     } - } -  - intMain () - { -     intna,i,j; in FB (); -      while(cin>>t) to     { +          while(t--) -         { theCin>>A; *Na=strlen (a); $              for(i= $; i>=0; i--)Panax Notoginseng             { -                 if(f[na][i]!=0) the                      Break; +             } A              for(j=i;j>=0; j--) the             { +cout<<F[na][j]; -             } $cout<<Endl; $         } -     } -     return 0; the}

1254 Problem V

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.