骰子和水桶是问题描述 [英] Dice and buckets is the problem description

查看:77
本文介绍了骰子和水桶是问题描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题描述

我们有一套6个骰子和49个水桶。每个桶具有相同的体积。每个骰子有6个面,编号为1到9之间的数字(包括两者)。没有必要知道哪个骰子具有哪个数字。骰子上的数字可能会重复。铲斗的编号从6到54.将6个骰子一次卷起100次,得到下面给出的骰子掷骰数据'x'。铲斗的体积为m。之后,掷骰子,将每个可见面上的数字相加到一个值,比如'n',并且将n个液体单位添加到第n个桶中。将桶装满'm'单位后,剩余的液体溢出桶外。

100卷的数据如下:

骰子卷数据(x)= [[4,6,3,8,1,1],[6,3,2,6,4,9],[3,2,8,9,4,5],[4] ,3,1,2,7,8],[6,5,9,7,1,7],[5,7,4,4,4,7],[9,7,6,7,2] ,9],[4,9,3,2,5,9],[7,3,2,5,8,8],[3,3,1,7,4,9],[5,7] ,3,9,9,4],[9,6,5,4,9,5],[1,7,8,1,1,1],[9,6,3,6,8,4] ],[3,5,2,6,5,5],[4,2,5,2,2,5],[3,2,2,1,5,1],[1,2,7] ,5,9,5],[5,6,2,6,6,9],[3,8,3,4,8,1],[7,5,7,1,9,9], [7,1,2,8,3,8],[7,6,3,1,3,6],[2,2,5,7,2,8],[7,3,5,3] ,4,8],[9,3,5,5,8,4],[8,1,3,2,1,3],[3,2,5,9,4,7],[8] ,5,8,5,2,8],[7,7,4,6​​,5,7],[9,4,4,3,6,9],[2,5,2,2,1] ,4],[3,7,7,9,7,5],[7,2,7,6,6,1],[1,7,3,9,9,7],[7,1] ,1,1,4,8],[6,9,6,6,4,6],[9,8,9,2,5,8],[8,8,8,9,6,8] ],[8,1,9,2,4,6],[5,8,2,2,4,9], [8,9,8,3,7,1],[7,1,5,1,6,8],[8,9,9,4,8​​,1],[9,3,4,4] ,2,6],[2,6,9,9,6,2],[5,9,3,1,9,4],[9,2,7,4,7,3],[1] ,7,8,2,7,8],[8,4,4,4,6,2],[3,4,8,6,8,4],[6,6,9,3,9] ,6],[1,1,4,6,6,2],[6,4,4,5,7,4],[4,2,1,2,3,1],[8,9] ,5,3,4,6],[3,3,5,8,2,5],[9,7,3,8,7,3],[9,3,6,5,7,1] ],[7,7,2,9,1,9],[6,8,7,4,5,4],[5,8,5,4,2,4],[7,3,4] ,5,9,4],[4,4,9,1,8,3],[5,3,9,1,3,1],[1,9,6,1,1,1], [1,3,1,2,9,7],[5,7,2,9,7,6],[2,5,1,8,9,5],[5,1,8,4] ,1,4],[4,5,1,2,5,3],[1,6,3,4,3,6],[5,8,4,5,7,5],[7] ,5,5,7,2,4],[6,7,1,6,8,7],[3,3,6,3,1,6],[7,6,8,9,6] ,9],[2,4,5,7,1,4],[1,8,4,8,2,5],[7,5,6,9,9,8],[8,8] ,1,8,9,5],[5,2,8,4,5,1],[9,8,1,6,8,9],[1,8,9,3,6,3] ],[3,4,5,6,2,8],[8,5,9,5,3,2],[7,6,5,9,5,5],[7,2,7] ,8,7,8],[5,7,6,6,9,2],[5,7,2,6,2,5],[4,1,6,9,4,9], [1,3,4,7,4,5],[5,8,9,7,4,1],[1,3,8,4,8,9],[2,8,7,4] ,8,3],[7,3,5,2,2,8],[1,6,5,4,1,1],[1,2,6,9,6,9],[8] ,5,2,7,3,8],[2,1,2,4,1,2]]

根据输入x和m,您的任务是打印以下内容:

1.水桶消耗的总容量。

2.从水桶飞过的液体总量。

3.总容量桶中留有空的空间。

约束

1. 0< m< = 50

2. m是一个整数

输入格式

第一行包含一个描述桶容量的整数。 />
输出

1.铲斗消耗的总容量。

2.从铲斗飞过的液体总量。

3.水桶剩余空间总量。



说明

示例1

输入

10

输出

300

2731

190
例2

输入

1

输出

30

3001

19



我的尝试:



我试过这个程序,但程序之间的混淆可以解决并帮助我解决这个程序

PROBLEM DESCRIPTION
We have a set of 6 dice and 49 buckets. Each bucket has the same volume. Each dice has 6 faces numbered with a digit between 1 and 9(both inclusive). It is not necessary to know which dice has which numbers. The numbers on a dice might be repeated. The buckets are numbered from 6 to 54. The 6 dice are rolled together at a time for 100 times to get the dice roll data ‘x’ given below. The buckets have a volume of ‘m’ units. After, the dice are rolled, the number on each of the visible face is summed up to a value, say ‘n’, and n units of liquid are added to the nth bucket. After a bucket is filled to ‘m’ units, the rest of the liquid added overflows out of the bucket.
The data of 100 rolls is given below:
Dice Roll Data(x)= [[4, 6, 3, 8, 1, 1], [6, 3, 2, 6, 4, 9], [3, 2, 8, 9, 4, 5], [4, 3, 1, 2, 7, 8], [6, 5, 9, 7, 1, 7], [5, 7, 4, 4, 4, 7], [9, 7, 6, 7, 2, 9], [4, 9, 3, 2, 5, 9], [7, 3, 2, 5, 8, 8], [3, 3, 1, 7, 4, 9], [5, 7, 3, 9, 9, 4], [9, 6, 5, 4, 9, 5], [1, 7, 8, 1, 1, 1], [9, 6, 3, 6, 8, 4], [3, 5, 2, 6, 5, 5], [4, 2, 5, 2, 2, 5], [3, 2, 2, 1, 5, 1], [1, 2, 7, 5, 9, 5], [5, 6, 2, 6, 6, 9], [3, 8, 3, 4, 8, 1], [7, 5, 7, 1, 9, 9], [7, 1, 2, 8, 3, 8], [7, 6, 3, 1, 3, 6], [2, 2, 5, 7, 2, 8], [7, 3, 5, 3, 4, 8], [9, 3, 5, 5, 8, 4], [8, 1, 3, 2, 1, 3], [3, 2, 5, 9, 4, 7], [8, 5, 8, 5, 2, 8], [7, 7, 4, 6, 5, 7], [9, 4, 4, 3, 6, 9], [2, 5, 2, 2, 1, 4], [3, 7, 7, 9, 7, 5], [7, 2, 7, 6, 6, 1], [1, 7, 3, 9, 9, 7], [7, 1, 1, 1, 4, 8], [6, 9, 6, 6, 4, 6], [9, 8, 9, 2, 5, 8], [8, 8, 8, 9, 6, 8], [8, 1, 9, 2, 4, 6], [5, 8, 2, 2, 4, 9], [8, 9, 8, 3, 7, 1], [7, 1, 5, 1, 6, 8], [8, 9, 9, 4, 8, 1], [9, 3, 4, 4, 2, 6], [2, 6, 8, 9, 6, 2], [5, 9, 3, 1, 9, 4], [9, 2, 7, 4, 7, 3], [1, 7, 8, 2, 7, 8], [8, 4, 4, 4, 6, 2], [3, 4, 8, 6, 8, 4], [6, 6, 9, 3, 9, 6], [1, 1, 4, 6, 6, 2], [6, 4, 4, 5, 7, 4], [4, 2, 1, 2, 3, 1], [8, 9, 5, 3, 4, 6], [3, 3, 5, 8, 2, 5], [9, 7, 3, 8, 7, 3], [9, 3, 6, 5, 7, 1], [7, 7, 2, 9, 1, 9], [6, 8, 7, 4, 5, 4], [5, 8, 5, 4, 2, 4], [7, 3, 4, 5, 9, 4], [4, 4, 9, 1, 8, 3], [5, 3, 9, 1, 3, 1], [1, 9, 6, 1, 1, 1], [1, 3, 1, 2, 9, 7], [5, 7, 2, 9, 7, 6], [2, 5, 1, 8, 9, 5], [5, 1, 8, 4, 1, 4], [4, 5, 1, 2, 5, 3], [1, 6, 3, 4, 3, 6], [5, 8, 4, 5, 7, 5], [7, 5, 5, 7, 2, 4], [6, 7, 1, 6, 8, 7], [3, 3, 6, 3, 1, 6], [7, 6, 8, 9, 6, 9], [2, 4, 5, 7, 1, 4], [1, 8, 4, 8, 2, 5], [7, 5, 6, 9, 9, 8], [8, 8, 1, 8, 9, 5], [5, 2, 8, 4, 5, 1], [9, 8, 1, 6, 8, 9], [1, 8, 9, 3, 6, 3], [3, 4, 5, 6, 2, 8], [8, 5, 9, 5, 3, 2], [7, 6, 5, 9, 6, 5], [7, 2, 7, 8, 7, 8], [5, 7, 6, 6, 9, 2], [5, 7, 2, 6, 2, 5], [4, 1, 6, 9, 4, 9], [1, 3, 4, 7, 4, 5], [5, 8, 9, 7, 4, 1], [1, 3, 8, 4, 8, 9], [2, 8, 7, 4, 8, 3], [7, 3, 5, 2, 2, 8], [1, 6, 5, 4, 1, 1], [1, 2, 6, 9, 6, 9], [8, 5, 2, 7, 3, 8], [2, 1, 2, 4, 1, 2]]
Your task is, given inputs x and m, print the following:
1. The total capacity consumed by buckets.
2. The total volume of liquid over flown from the buckets.
3. The total volume of empty space remaining in the buckets.
Constraints
1. 0 < m <=50
2. m is an integer
Input Format
First line contains an integer depicting volume of the bucket.
Output
1. The total capacity consumed by buckets.
2. The total volume of liquid over flown from the buckets.
3. The total volume of empty space remaining in the buckets.

Explanation
Example 1
Input
10
Output
300
2731
190
Example 2
Input
1
Output
30
3001
19

What I have tried:

I was tried this program but getting confusion between the program can you solve and help me to solve this program

推荐答案

我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但是我们不会为你做这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


为了解决你的功课,你需要学习像学习C 学习C ++



但是我会给你一些提示:为骰子滚动创建结构,或者如果可以的话,创建一个类。并为每个任务(或问题)提供一个函数,该函数采用结构指针为您提供结果。 (或是成员函数)。制作大量的调试输出,但在完成作业时删除最多。
For solving your homework you need to take a tutorial like Learn C or Learn C++.

But I will give you some tips: create struct for a dice roll, or a class if you can. And provide for every task (or problem) a function which takes a struct pointer gives you the result. (or is a member function). Make a lot of debug output, but remove most when the homework is ready.


#include <stdlib.h>
#include <time.h>
int main(int argc, char **argv) {
printf("Enter the number of dice: ");
int n, i;
scanf("%d", &n);
printf("The values on dice are: ( ");
for (i = 0; i < n; i++)
printf("%d ", (rand() % 6)+1);
printf(")");

    return 0;
}


这篇关于骰子和水桶是问题描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆