CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
    • Event Calendar
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » August 2010 Challenge » Stepping Numbers

Stepping Numbers

Problem code: STEPNUMS

  • All Submissions

All submissions for this problem are available.

Call a number stepping if adjacent digits, as well as the first and last digits, differ by one. How many n-digit base 11 stepping numbers are there? Give your answer modulo 4294967143.

For example, 8789A9 is a 6-digit base 11 stepping number. 9A0A and 234 are not stepping.

Input

The first line contains an integer T, the number of test cases (about 20000). Each of the next T lines contains an integer n (2 <= n < 264).

Output

Output the answer to each test case on a separate line.

Example

Input:
4
2
4
6
10

Output:
19
54
171
1958


Author: MichaelD
Date Added: 4-07-2010
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

if a leading zero wud be

calc_saransh @ 1 Aug 2010 03:41 PM

if a leading zero wud be permitted the number will be no longer of 2 digits... right??

is 01 is stepping number

v_new.c @ 1 Aug 2010 10:43 PM

is 01 is stepping number

Can you please add anything

mmaxio @ 2 Aug 2010 01:00 AM

Can you please add anything about leading zeros to statement?

y is the confusion getting

calc_saransh @ 2 Aug 2010 01:21 AM

y is the confusion getting created test case for 2 shows that 01 is not included.. and 01 is not a 2 digit number also...

Give your answer modulo

aimlessaim @ 4 Aug 2010 04:17 PM

Give your answer modulo 4294967143, means?

I have same question as Aim

gomsi_ @ 4 Aug 2010 06:28 PM

I have same question as Aim Less. Please reply

@Aim Less and techrascal: You

MichaelD @ 4 Aug 2010 07:04 PM

@Aim Less and techrascal: You should give the remainder when the answer is divided by 4294967143.

@Aim Less and

kyun @ 4 Aug 2010 08:44 PM

@Aim Less and techrascal

http://en.wikipedia.org/wiki/Modular_arithmetic

@Aim Less and

kyun @ 4 Aug 2010 10:43 PM

@Aim Less and techrascal

 

http://en.wikipedia.org/wiki/Modular_arithmetic

[edited by admin] do not

theeporithirumugam @ 7 Aug 2010 06:48 PM

[edited by admin] do not discuss test cases

[edited by admin] do not

theeporithirumugam @ 7 Aug 2010 06:54 PM

[edited by admin] do not discuss test cases

@radhakrishnan No!

balakrishnan_v @ 8 Aug 2010 01:51 AM

@radhakrishnan

No!

[edited by admin] do not

theeporithirumugam @ 8 Aug 2010 03:11 AM

[edited by admin] do not discuss test cases

@admin : Sorry For discussing

theeporithirumugam @ 8 Aug 2010 01:34 PM

@admin : Sorry For discussing test Cases

when coding i received the

theeporithirumugam @ 9 Aug 2010 05:21 PM

when coding i received the warning when MOD IS SET TO THE GIVEN NUMBER  4294967143

k recitified

theeporithirumugam @ 9 Aug 2010 05:38 PM

k recitified

The problem could be solved

nadeemoidu @ 11 Aug 2010 04:46 PM

The problem could be solved by a solution which is of a higher complexity than the official solution. This made it an "optimize as much as you can" challenge :)

guys..tell me how did you

algoninja @ 11 Aug 2010 06:57 PM

guys..tell me how did you come up with such complex solution? Do you know the solution before hand? I am not asking about the programming part. I am asking about the formula...

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of computer programming. At CodeChef we work hard to revive the geek in you by hosting programming contests on a monthly basis. We also aim to have training sessions and events related to online programming for programmers around the world. Apart from providing a platform for programming competitions, CodeChef also has various tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our judge accepts solutions in over 35+ programming languages. Online programming was never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming competitions that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly programming contests and the shorter format Cook-off programming contests. Put yourself up for recognition and win great prizes. Prizes worth up to Rs.20,000 and $700 are up for grabs every month along with lots more CodeChef goodies.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be part of CodeChefs Forums and interact with all our programmers love helping out other programmers and share their ideas.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. Be a part of the CodeChef community through CodeChef meetups and techtalks. You can also host a programming contest for your institute on CodeChef and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com