Page 1 of 2
11192 - Group Reverse
Posted: Sun Mar 04, 2007 6:18 pm
by Mister X

no idea why WA on such an easy problem
cut...
Posted: Sun Mar 04, 2007 6:25 pm
by arsalan_mousavian
your program fails on
the output should be:
have fun
Posted: Sun Mar 04, 2007 6:29 pm
by Mister X
11192,WA
Posted: Tue Jun 26, 2007 6:05 pm
by turcse143
HI, everybody i solve this problem but i got WA.
I don't know the problem of my code.
I want more sample input/output.
Is this sample input/output only for the special case:G=1;
Ples help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Posted: Wed Jun 27, 2007 10:48 pm
by Jan
Try the cases.
Input:
Code: Select all
1 ABCDEFGHIJKLMNOPQRSTUVWX
2 ABCDEFGHIJKLMNOPQRSTUVWX
3 ABCDEFGHIJKLMNOPQRSTUVWX
4 ABCDEFGHIJKLMNOPQRSTUVWX
6 ABCDEFGHIJKLMNOPQRSTUVWX
8 ABCDEFGHIJKLMNOPQRSTUVWX
0
Output:
Code: Select all
XWVUTSRQPONMLKJIHGFEDCBA
LKJIHGFEDCBAXWVUTSRQPONM
HGFEDCBAPONMLKJIXWVUTSRQ
FEDCBALKJIHGRQPONMXWVUTS
DCBAHGFELKJIPONMTSRQXWVU
CBAFEDIHGLKJONMRQPUTSXWV
Hope these help.
Posted: Thu Jun 28, 2007 8:43 pm
by turcse143

thanks GURU, i got AC
THANKS A LOT
Re: 11192 - Group Reverse
Posted: Mon May 26, 2008 10:58 am
by Obaida
It seemed very easy to me.
I just calculated the length and then divided the length by G to find the group length.
then in next step run a loop to length. and when it's divisible then reverse.

Re: 11192 - Group Reverse
Posted: Thu Jun 19, 2008 12:21 pm
by maruf
thank u shiplu vai
i hv got ac

Re: 11192 - Group Reverse
Posted: Fri Jun 20, 2008 11:46 am
by shiplu_1320
input
your code output a null after S
write the output in a file for this input and see.
Good luck.
Re: 11192 - Group Reverse
Posted: Tue Jan 31, 2012 3:54 pm
by scofield
Hello, i solved the problem but i always got Wrong Answer, i can't identify what's wrong in the code.
Could you please give me a help to check what's wrong?
Thanks in advance.
11192 - Group Reverse
Posted: Tue Jan 31, 2012 4:02 pm
by scofield
Hello, i solved the problem and tested with some sample inputs, the outputs are always right, but when submit i got Wrong Answer, i can't identify what's wrong in the code.
Could you please give me a help to check what's wrong?
Code: Select all
int main()
{
unsigned char nbrGroups=48, lines=0, offset = 0x00, out_offset=0,
outstr[100], chars, count, groupSize, i;
string str;
//number of groups valid between 0 and 9
while((nbrGroups >= 48) && (nbrGroups <= 57) && (++lines < 11))
{
cin >> nbrGroups;
cin >> str;
offset=0;
out_offset=0;
if(nbrGroups != 48)
{
//calculate the group size
for(count=0;str[count] != 0x00; count++);
//check if the total length is multiple of nbrGroups
if(count%(nbrGroups-48) == 0)
{
groupSize = count/(nbrGroups-48);
//go throught the groups
for(count=0;count<(nbrGroups-48);count++)
{
//invert the group
for(i=offset+groupSize;i != offset ;i--)
outstr[out_offset++] = str[i-1];
//set the position to the next group
offset+=(groupSize);
}
outstr[out_offset] = 0x00;
cout << outstr << endl;
}
}
}
return 0;
}
Thanks in advance.
Re: 11192 - Group Reverse
Posted: Fri Dec 14, 2012 9:06 pm
by nazmus_20000
Please can any one tell why i am getting compiler Error????I m really fed up with this things...
#include<stdio.h>
#include<string.h>
int main()
{
int n,i,j,k,l,t;
char a[1000],b[1000];
while(scanf("%d",&n)!=EOF)
{
if(n==0)break;
else
{
scanf("%s",&a);
l=strlen(a)/n;
for(i=0,j=0;i<n;i++)
{
for(k=0,t=0;t<l;k++,t++)
{
b[k]=a[j];
j++;
}
b[k]='\0';
strrev(b);
printf("%s",b);
}
printf("\n");
}
}
return 0;
}
Re: 11192 - Group Reverse
Posted: Sat Dec 15, 2012 6:19 am
by brianfry713
You can see the reason for your Compiler Error by clicking My Submissions.
In this case it's because strrev() isn't included in the judge's compiler. Write your own strrev().
Re: 11192 - Group Reverse
Posted: Mon Dec 17, 2012 6:42 pm
by nazmus_20000
Re: 11192 - Group Reverse
Posted: Tue Oct 29, 2013 12:15 pm
by sadmansobhan