poj 1959 Darts

本文探讨了如何通过编程计算在飞镖游戏中不同得分组合的可能性,深入解析了得分构成及组合总数的计算方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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;
}


内容概要:该PPT详细介绍了企业架构设计的方法论,涵盖业务架构、数据架构、应用架构和技术架构四大核心模块。首先分析了企业架构现状,包括业务、数据、应用和技术四大架构的内容和关系,明确了企业架构设计的重要性。接着,阐述了新版企业架构总体框架(CSG-EAF 2.0)的形成过程,强调其融合了传统架构设计(TOGAF)和领域驱动设计(DDD)的优势,以适应数字化转型需求。业务架构部分通过梳理企业级和专业级价值流,细化业务能力、流程和对象,确保业务战略的有效落地。数据架构部分则遵循五大原则,确保数据的准确、一致和高效使用。应用架构方面,提出了分层解耦和服务化的设计原则,以提高灵活性和响应速度。最后,技术架构部分围绕技术框架、组件、平台和部署节点进行了详细设计,确保技术架构的稳定性和扩展性。 适合人群:适用于具有一定企业架构设计经验的IT架构师、项目经理和业务分析师,特别是那些希望深入了解如何将企业架构设计与数字化转型相结合的专业人士。 使用场景及目标:①帮助企业和组织梳理业务流程,优化业务能力,实现战略目标;②指导数据管理和应用开发,确保数据的一致性和应用的高效性;③为技术选型和系统部署提供科学依据,确保技术架构的稳定性和扩展性。 阅读建议:此资源内容详尽,涵盖企业架构设计的各个方面。建议读者在学习过程中,结合实际案例进行理解和实践,重点关注各架构模块之间的关联和协同,以便更好地应用于实际工作中。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值