Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

WA

Posted by paradox12 at 2014-08-05 19:07:36 on Problem 2136 and last updated at 2014-08-05 19:08:10
I am NOT printing any extra spaces or lines still getting WA,
code attached
please help.




#include <iostream>
#include<stack>
#include<vector>
#include<set>
#include<queue>
#include<stdio.h>
#include<algorithm>
using namespace std;

#define gc getchar
#define pc(x) putchar
#define pi(n) printf("%d",n)
#define pll(n) printf("%lld",n)
#define ps printf(" ")
#define pn printf("\n")
#define rep(i,n) for(i=0;i<n;i++)
#define fu(i,a,n) for(i=a;i<=n;i++)
#define fd(i,n,a) for(i=n;i>=a;i--)
inline int sn()
{
    int n=0;
    int ch=gc();
    while( ch <48 )ch=gc();
    while( ch >47 )
    n = (n<<3)+(n<<1) + ch-'0', ch=gc();
    return n;
}
int main()
{
    char s[100];
    int i,j,max=0;
    vector<int> x(30,0);
    rep(i,4)
    {
        scanf("%[^'\n']s",s);
        //printf("%s\n",s);
        for(j=0;s[j]!=0;j++)
        {
            if(((int)s[j] <65 || (int)s[j]>91)) continue;
            x[(int)s[j]-65]++;
        }
        getchar();
    }
    rep(i,30)
    {
        if(max < x[i]) max=x[i];
    }
    char ans[100][100];
    rep(i,max+1)
    rep(j,27) ans[i][j]=' ';
    rep(i,26)
    {
        rep(j,x[i])
        {
            ans[max-1-j][i]='*';
        }
    }
    vector<int> limit(max+1,26);
    rep(i,max)
    {
        fd(j,25,0)
        {
            if(ans[i][j]==' ') limit[i]--;
            else break;
        }
        //pi(limit[i]);pn;
    }
    rep(i,max)
    {
        rep(j,limit[i])
        {
            printf("%c",ans[i][j]);
            if(j!=limit[i]-1) ps;
        }pn;
    }
    printf("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator