Hangzhou Electric 2085--nuclear reactor (play table)

Source: Internet
Author: User

Nuclear reactor

Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 11922 Accepted Submission (s): 5420


Problem description There are two types of events occurring in a nuclear reactor:
When the high-energy particle strikes the nucleus, the particle is absorbed, releasing 3 high-energy particles and a low-energy particle.
When the low-energy particle strikes the nucleus, the particle is absorbed, releasing 2 high-energy particles and a low-energy particle.
Assuming that at the beginning (0 microseconds) only one high-energy particle is injected into the nuclear reactor, each microsecond causes an event (for an event where all particles currently present collide with the nucleus), and the number of high-energy and low-energy particles in n microseconds is determined.

Input inputs contain some integer n (0≤n≤33), in microseconds, where n is-1 means the processing is complete.

Output outputs the number of high-energy and low-energy particles in n microsecond time respectively, separated by a comma space between the high energy particle and the low energy particle quantity. Each output occupies one row.

Sample Input
5 2 -1

Sample Output
571 209  One 4 long int against GNU C + +, using __int64 against VC6

SOURCE2006/1/15 ACM Program Design Final Exam//careful;
1#include <stdio.h>2__int64 biao[ *],sieve[ *];3 intMain ()4 {5     intI,j,n;6biao[1]=3; sieve[1]=1;7      for(i=2;i< the; i++)8     {9biao[i]=biao[i-1]*3+sieve[i-1]*2;Tensieve[i]=biao[i-1]+sieve[i-1]; One     } A      while(~SCANF ("%d", &n) &&n!=-1) -     { -         if(n==0) theprintf"1, 0\n"); Recently, always forget to judge the initial conditions; -         Else -printf"%i64d,%i64d\n", Biao[n],sieve[n]); -     } +     return 0; -}

Hangzhou Electric 2085--nuclear reactor (play table)

Related Article

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.