HUD 12,493 Angle Shape

Source: Internet
Author: User

Original title Link: Click here

Solving process: Formula: An=an-1+6 (n-1). (n>=1)

Formula derivation:

By:

1 triangles at most to divide the plane into 2 parts

2 triangles divide the plane into 8 parts (more than 6)

3 triangles divide the plane into 20 parts (more than 12)

4 triangles divide the plane into 38 parts (more than 18)

From this speculation

n triangles can divide a plane into a block

Then An=an-1+6 (n-1), where a1=2

Can be solved by the formula an=3n (n-1) +2

That is, when n=6, a6=92

Source:

#include <iostream>#include<stdio.h>using namespacestd;intsum;intTintb) {    if(b==1) {sum+=2; returnsum; } Sum+=6* (b-1); b--; T (b);}intMain () {intN,a; scanf ("%d",&N);  while(n--) {sum=0; scanf ("%d",&a);        T (a); printf ("%d\n", sum); }    return 0;}
View Code

HUD 12,493 Angle Shape

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.