hoj-1011/poj-1589

Source: Internet
Author: User

WA for a half day.

Like the following possible error:

Whether the end of each line is a direct line break without extra space (try n = 17)

With 62/max_length instead of 60.

Do not understand why someone tle,re is to write their own sort of too slag? Then why bothered have to write their own sort

The output of this transpose really tangled up with me for a long time, especially those that should not play the space.

Line I, the string in column J is I+j*y (Y is the number of rows that should eventually be output) (array from 0~n-1)

1#include <cstdio>2#include <algorithm>3#include <iostream>4#include <cstring>5 using namespacestd;6 7 stringa[ $];8 9 intMainvoid)Ten { One   intN, M; A   intx, y; -   intMAXN; -   intp =0; the    while(cin>>N) { -printf"------------------------------------------------------------\ n"); -      for(inti =0; I < n; ++i) cin>>A[i]; -Sort (A, A +n); +MAXN =0; -      for(inti =0; I < n; ++i) +       if(Maxn <a[i].length ()) AMAXN =a[i].length (); atx = +/(maxn+2); -y = n/x; -     if(n% x) y++; -      for(inti =0; i < Y; ++i) { -        for(intj =0; J < X; ++j) { -m = i+j*y; in     if(M >= N) Break; -     Else{ tocout<<A[m]; +       if(M + Y <N) -          for(intK =0; K < maxn+2-a[m].length (); ++K) cout<<' '; the     } *       } $cout<<Endl;Panax Notoginseng     } -   } the   return 0; +}

hoj-1011/poj-1589

Related Keywords:

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.