HDU 1220 cube (combined mathematics)

Source: Internet
Author: User
/* Give You A cube with a side length of N and cut it into N x n cubes per unit volume. Find the logarithm of the cube with a number of common vertices <= 2. The number of public points may be: 0, 1, 2, 4. We can use the total logarithm to subtract the logarithm of four public points. Total logarithm: N ^ 3 * (N ^ 3-1)/2 (a total of N ^ 3 small blocks, from which two blocks are selected) the cube pairs at the four intersections are two cubes in common, so we only need to find the number of common faces in each unit of area in a large cube, the result is as follows: N ^ 3 * (N ^ 3-1)/2-3 * n ^ 2 (n-1) */# include <stdio. h> # include <algorithm> # include <string. h> using namespace STD; int main () {int N; while (~ Scanf ("% d", & N) {printf ("% d \ n", (N * n * N-1 )) /2-3 * n * (n-1);} return 0 ;}

HDU 1220 cube (combined mathematics)

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.