Eighth annual Blue Bridge Cup JAVAB---bearing pressure calculation

Source: Internet
Author: User

title: Pressure calculation Planet X's high-tech labs are neatly stacked with precious metal materials. The shape and size of each metal material is identical, but the weight is different.                             The metal material is rigidly stacked into a pyramid shape. 7 5 8 7 8 8 9 2 7 2  8 1 4 9 1 8 1 8 8 4 1 7 9 6 1 4 5 4 5 6 5 5 6 9 5                    6 5 5 4 7 9 3 5 5 1 7 5 7 9 7 4 7 3 3 1 4 6 4 5 5 8 8 3 2 4 3 1 1 3 3 1 6 6 5 5 4 4 2 9 9 9 2 1 9 1 9 2 9 5 7 9 4 3 3 7 7 9 3 6 1 3 8 8 3 7 3 6 8 1 5 3 9 5 8 3 8 1 8 3 3 8 3 2 3 3 5 5 8 5 4 2 8 6 7 6 9 8 1 8 1 8           4 6 2 2 1 7 9 4 2 3 3 4 2 8 4 2 2 9 9 2 8 3 4 9 6 3 9 4 6 9 7 9 7 4 9 7 6 6 2 8 9 4 1 8 1 7 2 1 6 9 2 8 6 4 2 7 9 5 4 1 2 5 1 7 3 9 8 3 3 5 2 1 6 7 9 3 2 8 9 5 5 6 6 6 2 1 8 7 9 9 6 7 1 8 8 7 5  3 6 5 4 7 3 4 6 7 8 1 3 2 7 4 2 2 6 3 5 3 4 9 2 4 5 7 6 6 3 2 7 2 4 8 5 5 4 7 4 4 5 8 3 3 8 1 8 6 3 4 6 3 8 2 9 6 1 24 1 3 3 5 3 4 9 6 3 8 6 5 9 1 5 3 2 6 8 8 5 3 2 2 7 9 3 3 2 8 6 9 8 4 4 9 5 8 2 6 3 4 8 4 9 3 8 8 7 2 7 9 2 5 1 9 2 6 5 3 9 3 5 7 3 5 4 2 8 9 7 7 6 6 8 7 5 5 8 2 4 7 7 4 7 2 6 9 2 1 8 2 9 8 5 7 3 6 5 5 5 6 3 5 3 9 5 8 9 5 4 1 2 6 1 4 3 5 3 2 4 1The number of x x x x x x x x x x x × X × x x x x x x x is the weight of the metal block (large unit of measurement). The bottom-most x represents 30 highly accurate electronic scales. Assuming that the weight of each piece of material is very accurately averaged over the two metal blocks below, finally, the weight of all metal blocks is strictly and accurately halved on the lowest level of the electronic scale. Electronic scales are very small, so the number shown is very large. The staff found that the number of scales with the smallest readings was as follows:2086458231would you please figure out: What is the number of the scales with the largest readings? Note: You need to submit an integer, do not fill in any superfluous content. 

Topic Ideas:

First we turn the triangular shape into a 30*30 rectangle,

7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 8 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 2 7 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 1 4 9 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 1 8 8 4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 9 6 1 4 5 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 6 5 5 6 9 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 5 4 7 9 3 5 5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 5 7 9 7 4 7 3 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 6 4 5 5 8 8 3 2 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 3 3 1 6 6 5 5 4 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 9 9 2 1 9 1 9 2 9 5 7 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 3 3 7 7 9 3 6 1 3 8 8 3 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 6 8 1 5 3 9 5 8 3 8 1 8 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 3 2 3 3 5 5 8 5 4 2 8 6 7 6 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 1 8 1 8 4 6 2 2 1 7 9 4 2 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0
2 8 4 2 2 9 9 2 8 3 4 9 6 3 9 4 6 9 0 0 0 0 0 0 0 0 0 0 0 0
7 9 7 4 9 7 6 6 2 8 9 4 1 8 1 7 2 1 6 0 0 0 0 0 0 0 0 0 0 0
9 2 8 6 4 2 7 9 5 4 1 2 5 1 7 3 9 8 3 3 0 0 0 0 0 0 0 0 0 0
5 2 1 6 7 9 3 2 8 9 5 5 6 6 6 2 1 8 7 9 9 0 0 0 0 0 0 0 0 0
6 7 1 8 8 7 5 3 6 5 4 7 3 4 6 7 8 1 3 2 7 4 0 0 0 0 0 0 0 0
2 2 6 3 5 3 4 9 2 4 5 7 6 6 3 2 7 2 4 8 5 5 4 0 0 0 0 0 0 0
7 4 4 5 8 3 3 8 1 8 6 3 2 1 6 2 6 4 6 3 8 2 9 6 0 0 0 0 0 0
1 2 4 1 3 3 5 3 4 9 6 3 8 6 5 9 1 5 3 2 6 8 8 5 3 0 0 0 0 0
2 2 7 9 3 3 2 8 6 9 8 4 4 9 5 8 2 6 3 4 8 4 9 3 8 8 0 0 0 0
7 7 7 9 7 5 2 7 9 2 5 1 9 2 6 5 3 9 3 5 7 3 5 4 2 8 9 0 0 0
7 7 6 6 8 7 5 5 8 2 4 7 7 4 7 2 6 9 2 1 8 2 9 8 5 7 3 6 0 0
5 9 4 5 5 7 5 5 6 3 5 3 9 5 8 9 5 4 1 2 6 1 4 3 5 3 2 4 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

According to this rectangle, we can pass the weight on the last layer of electronic scale from top to bottom. Get the result max=135.34946863353252 min=3.8863313030451536;

According to the information of the topic, the minimum value shows 2086458231, according to this number we can calculate the maximum number of the display is how much, calculated to be 72665192664

The code is as follows:

1 ImportJava.math.BigDecimal;2 ImportJava.util.Scanner;3 4  Public classbearing pressure calculation {5 6      Public Static voidMain (string[] args) {7Scanner sc=NewScanner (system.in);8         Doublea[][]=New Double[30] [30];9          for(inti=0;i<30;i++){Ten              for(intj=0;j<30;j++){ Onea[i][j]=sc.nextdouble (); A             } -         } -          for(inti=1;i<30;i++){ the              for(intj=0;j<30;j++){ -                 if(j==0){ -A[i][j]+=a[i-1][j]/2; -}Else{ +A[i][j]+=a[i-1][j]/2+a[i-1][j-1]/2; -                 } +             } A         } at         DoubleMax=-1; -         Doublemin=10000000; -          for(intj=0;j<30;j++){ -             if(Max<a[29][j]) max=a[29][j]; -             if(Min>a[29][j]) min=a[29][j]; -         } inSystem.out.println (max+ "" +min); -  to         Doublem1=Max; +         DoubleM2=min; -         Doublecs=2086458231; the         Doublemaxshow=cs/m2*M1; *BigDecimal bg=NewBigDecimal (maxshow+ ""); $ System.out.println (BG);Panax Notoginseng  -          the     } +  A}

Finally this result problem ah, I use BigInteger or bigdecimal all have problems, on the Internet search, double remove e method, on an article on wrote ~ ~ ~

Own exam time did not make out, this year Blue Bridge Cup immediately again began, re-do before the problem, the internet Baidu a little thought to make. A bit more blog. Blue Bridge cup Good luck!!!

Eighth annual Blue Bridge Cup JAVAB---bearing pressure calculation

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.