Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这题的描述。。。From the 9-th month in a period of m months (0 < m < 3, m is natural number) every pair of the parent mice give birth to two pairs of mice.这句话太有歧义了

Posted by KatrineYang at 2016-09-24 11:54:31 on Problem 1352 and last updated at 2016-09-24 11:55:37
可以有三种理解:
1,从第9个月起,每m个月生2只直到挂掉。比如m=2,那就是所有9,11,13,。。。岁的老鼠都生;
2,从第9个月起到第8+m个月之间均匀地总共生2只,即如果m=1那么9岁的老鼠生2只,否则,9/10岁的老鼠各生一只;
3,从第9个月到第8+m个月每个月生2只。
题目想说的是第3种。害的我嚷肮两次
附代媽
#include <iostream>
using namespace std;

int main() {
	int n,m,k;
	char fei;
	while(1){
		cin >> n;
		if(!(~n)) break;
		cin >> fei >> m >> fei >> k;
		cout << n << "," << m << "," << k << ": ";
		int q[50][50] = {0};
		q[1][1] = 1;
		for(int t = 2; t <= k; t++){
			int sum = 0;
			for(int liv = 2; liv <= n && liv <= t; liv++){
				q[t][liv] = q[t-1][liv-1];
				sum += q[t-1][liv-1];
			}
			if(sum <= 100){
				int born = q[t][7] + q[t][8];
				/*
				int jiu = 9;
				while(jiu <= n){
					born += (q[t][jiu] << 1);
					jiu += m;
				}*/
				if(m==1) born += 2*q[t][9];
				else born += 2*(q[t][9] + q[t][10]);
				q[t][1] = born;
			}
		}
		int s = 0;
		for(int lv = 1; lv <= n && lv <= k; lv++){
			s += q[k][lv];
		}
		cout << s << endl;
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator