例2 输入 1 输出 30 3001 19 我的尝试: 我试过这个程序,但程序之间的混淆可以解决并帮助我解决这个程序PROBLEM DESCRIPTIONWe 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.Constraints1. 0 < m <=502. m is an integerInput FormatFirst line contains an integer depicting volume of the bucket.Output1. 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.ExplanationExample 1 Input 10Output 3002731190Example 2 Input 1Output30300119What 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;} 这篇关于骰子和水桶是问题描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 12:07