[TOJ 3089] stacked dice and toj3089

Source: Internet
Author: User

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

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.