[TOJ 3089] stacked dice and toj3089
Description
Everyone has played dice. Dice are generally used as a gambling tool, but we have different ACM members. We can use dice to write various questions and give ACM-loving people the ability to think about problems. Look at the dice:
Familiar with o (∩ _ ∩) o ~~~
Not much nonsense. Let's look at the question: Now I will give you n dice and fold them up in a standardized manner. Some dice may be covered after they are stacked, how do you fold the number of points and the maximum number of pages that are not covered?
Note: The stacks cannot be staggered during stacking, that is, the two sides must be fully stacked. And the area stacked on the ground is also covered. Do you know?
The stacked method above is invalid.
Dice: points on each side are: 1, 2, 3, 4, 5, 6
The opposite of is, the opposite of 2 is, and the opposite of 3 is,
The relationship between locations is shown in the figure.
Input
Enter multiple groups of data.
Enter the number of given dice n, 1 <=n <= 1000000.
Output
The number of points that are not covered in the output is the largest sum. Line feed between each data.
Sample Input
1
3
5
9
Sample Output
20
51
81
141
Calculate the maximum number of points for stacked dice:
① When there is only one dice, the number of points is 20 (points hit the ground)
② When the number of dice is greater than or equal to 2, the total number of dice is 15 * n + 6
#include "stdio.h"using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { if(n==1) printf("20\n"); else printf("%d\n",15*n+6); } return 0;}