October 22 Square

Source: Internet
Author: User

Topic

1177. Square

Time limit:1000MS memory limit:64000KB

Title description again to summer vacation, Conan, Ayumi, Mitsuhiko, Genta together to Hakase home happy play (but you do not ...). )。
Ayumi, Mitsuhiko, Genta began to draw a square in turn (obviously AI will not participate in this activity), one person a pen, draw one, to the last square four-sided midpoint for the vertex and then draw ah painting ah painting ah ... Finally altogether the K-squares were drawn. In the end they wanted to know how long they had painted each.

"Sample Interpretation"
The input input line contains two integer n,k that represent the length of the first square and the number of squares. Output one line, three real numbers, respectively, representing Ayumi, Mitsuhiko, Genta the length of the painting, the answer is reserved 3 decimal places. Input sampleCopy100 2 Output ExampleCopy270.711 241.421 170.711 explains "data size and conventions" for 100% of data satisfaction. 、Analysis Law problem ...
Each person will do it at least once in each square.and then do one more time with the lawThe first one 1a second 2.... Code
1#include <bits/stdc++.h>2 using namespacestd;3 Doublea[Ten];4 intMain ()5 {6     intK,n;7Cin>>k>>N;8     Doublekk=K;9     intt=1;Ten      for(intI=1; i<=n;i++) One     {    A         if(t%4==0) -t=1; -         if(i==1) the         { -a[1]+=KK; -a[2]+=KK; -a[3]+=KK; +a[t]+=KK; -Kk/=2; +t++; A             Continue; at         } -         Else -         { -a[1]+=sqrt ((KK*KK) + (kk*kk)); -a[2]+=sqrt ((KK*KK) + (kk*kk)); -a[3]+=sqrt ((KK*KK) + (kk*kk)); inA[t]+=sqrt ((KK*KK) + (kk*kk)); -         } tot++; +Kk=sqrt ((KK*KK) + (KK*KK))/2; -     } theprintf"%.3f%.3f%.3f", a[1],a[2],a[3]); *}

October 22 Square

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.