POJ 3440 Java Spit Slot

Source: Internet
Author: User

Very egg pain of a problem, the topic itself is very simple, but the final output is so disgusting,

There are three points to note:

1.title Single Complex problem

2.title the number of spaces after a single complex is different

There should be a blank line between the 3.Case, but the last case can not have a blank line, this is too disgusting, began to never find ... Direct loop output return, always error PE,

The last is the code: easy to reach the party:

ImportJava.text.DecimalFormat;ImportJava.util.Scanner; Public classmain{ Public Static voidMain (String[]args) {intT,ca=0; Scanner s=NewScanner (system.in);  for(T=s.nextint (); t>0; t--)          {              DoubleN,m,t,c; Double[]a =New Double[5]; N=s.nextdouble (); M=s.nextdouble (); T=s.nextdouble (); C=s.nextdouble (); a[0]=t*t*n*m; a[1]= (t-c) * (t-c) *n*m+ (c* (t-c) +c*c/4.0) *4+c* (t-c) * (n+m-4); a[2]=2*c* (t-c) *n*m-c* (t-c) * (n+m) +c*c* (n+m-2); a[4]=math.pi*c*c/4* (n-1) * (m-1); a[3]=a[0]-a[1]-a[2]-a[4]; System.out.println ("Case" + ++ca+ ":"); DecimalFormat DF=NewDecimalFormat ("0.0000");  for(inti=1;i<=4;i++) System.out.println ("Probability of Covering" +i+ (i==1? "tile =": "tiles =") +df.format (a[i]/a[0]*100.0) + "%"); if(t!=1) {System.out.println (); }        }      }  }

POJ 3440 Java Spit Slot

Related Article

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.