poj 1959 Darts

Darts
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 1236 Accepted: 714

Description

Background 
Many nations (including Germany) have a strange tradition of throwing small arrows at round flat targets (usually, these small arrows are called darts and so is the game). 
In a darts game, the target consists of a flat circle which is divided into slices and rings. The slices are numbered from 1 to 20 and the rings are called double or treble ring (see Figure 5). The center part of the board is called the bull’s eye which is further subdivided into an inner part (the real bull’s eye) and an outer part (called the bull, see Fig. 5). 

Players take turns in throwing the darts at the board. Their score depends on the areas they hit with their darts. Hitting the 20 slice in the double ring scores 2 * 20 = 40 points. Hitting the treble ring multiplies the score by 3. The inner part of the bull’s eye counts 50, the outer part 25 points. 
Every turn consists of 3 darts being thrown at the dartboard by a player and his score is the sum of the scores of all darts which hit the dartboard in one of the numbered areas. 
Problem 
Your friends have played darts yesterday and from their match the scores are still on the blackboard in your room. From reading the scores, you would like to know, how the individual players threw their darts and where they could have hit the dartboard. You are to write a program which, given the score of a turn,reconstructs the number of possible distinct combinations of hits of the three darts on the dartboard ignoring the order in which the darts are thrown. 
As an example, consider the overall score of 3 of a player. This could have happened as follows: 
3 = 0 +    0 +    1*3    one dart hits slice 3

3 = 0 +    0 +    3*1    one dart hits slice 1 in treble ring

3 = 0 +    1*1 +  1*2    one dart hits slice 1 and one dart hits slice 2

3 = 0 +    1*1 +  2*1    one dart hits slice 1 and one dart hits slice 1 in double ring

3 = 1*1 +  1*1 +  1*1    all three darts hit slice 1

The resulting sum of possible distinct combinations is 5. 
A more complex example is score 9: 
9 = 0 +    0 +    1*9    one dart hits slice 9

9 = 0 +    0 +    3*3    one dart hits slice 3 in treble ring

9 = 0 +    1*1 +  1*8    one dart hits slice 1 and one dart hits slice 8

9 = 0 +    1*1 +  2*4    one dart hits slice 1 and one dart hits slice 4 in double ring

...

9 = 0 +    3*2 +  1*3    one dart hits slice 2 in treble ring and one dart hits slice 3

9 = 1*1 +  1*1 +  1*7    two darts hit slice 1 and one dart hits slice 7

...

9 = 2*1 +  3*1 +  2*2    one dart hits slice 1 in double ring, one dart hits slice 1 in treble ring and one dart hits slice 2 in double ring

9 = 1*3 +  1*3 +  1*3    three darts hit slice 3

9 = 1*3 +  1*3 +  3*1    two darts hit slice 3 and one dart hits slice 1 in treble ring

9 = 1*3 +  3*1 +  3*1    one dart hits slice 3 and two darts hit slice 1 in treble ring

9 = 3*1 +  3*1 +  3*1    three darts hit slice 1 in treble ring

What is the number of combinations? Write a program to find out.

Input

The first line contains the number of scenarios. 
For each scenario, you are give a dart score as a single positive integer on a line by itself.

Output

The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print the number of possible dart score combinations on a line by itself.Finish the output of every scenario with a blank line.

Sample Input

2
3
9

Sample Output

Scenario #1:
5

Scenario #2:
41

题目链接:http://poj.org/problem?id=1959


题目大意:有一个飞镖盘,有数字区域,2倍对应数字区域,3倍对应数字区域,25分区域,50分区域,数字对应分数,飞3次,求能得到输入分数的投掷情况总数。


代码如下:

#include <cstdio>
#include <cstring>
int b[182];//最多有180分
int a[63]={0,1,2,2,3,3,4,4,5,6,6,6,7,8,8,9,9,10,10,11,12,12,12,13,14,14,15,15,16,16,17,18,18,18,19,20,20,
21,22,24,24,26,27,28,30,30,32,33,34,36,36,38,39,40,42,45,48,51,54,57,60,50,25};
//20个原数字,前10个的2倍,3倍的数字,后10个的2倍,3倍的数字,50,25见题目
int main()
{
    int t,cnt=0,i,j,k,n,l;
    scanf("%d",&t);
	memset(b,0,sizeof(b));
    for(i=0;i<=180;i++)   //枚举得到每个分数的种数
    {
        for(j=0;j<63;j++)
            for(k=j;k<63;k++)
                for(l=k;l<63;l++)
					if(i==a[j]+a[k]+a[l])
						b[i]++;
    }
    while(t--)
    {
        scanf("%d",&n);
        printf("Scenario #%d:\n%d\n",++cnt,b[n]);
        if(t)
            printf("\n");
    }
    return 0;
}

 

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 、4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、下载 4使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、 4下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值