All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
AcmNightivy
New poster
Posts: 36 Joined: Tue Dec 04, 2007 10:20 am
Post
by AcmNightivy » Sun Feb 10, 2008 11:48 am
i have got PE and try hard to correct it..but I got PE finally..I'm getting crazy
..help
Code: Select all
#include <stdio.h>
#include "string.h"
char str[102][102];
int main ()
{
char result[102];
int count;
int num = 0;
int maxlen = 0;
int i, j;
while (gets (str[num++]));
//for (i = 0; i < 26; i++)
// gets (str[num++]);
for (i = 0; i < num; i++)
{
j = strlen (str[i]);
if (j > maxlen)
maxlen = j;
}
for (i = 0; i < maxlen; i++)
{
count = 0;
for (j = num - 1; j >= 0; j--)
{
if (str[j][i] != '\0')
result[count++] = str[j][i];
else
result[count++] = ' ';
}
result[count] = '\0';
printf ("%s\n", result);
}
return 0;
}
sapnil
Experienced poster
Posts: 106 Joined: Thu Apr 26, 2007 2:40 pm
Location: CSE-SUST
Contact:
Post
by sapnil » Mon Feb 11, 2008 12:45 pm
To AcmNightivy
Code: Select all
You print an extra space in starting of every
line of output
Thanks
Sapnil
"Dream Is The Key To Success"
@@@ Jony @@@
AcmNightivy
New poster
Posts: 36 Joined: Tue Dec 04, 2007 10:20 am
Post
by AcmNightivy » Sun Feb 17, 2008 4:00 pm
[quote="sapnil"]To AcmNightivy
Code: Select all
You print an extra space in starting of every
line of output
But I haven't print an extra space in every output?What's the meaning of this extra space??
sapnil
Experienced poster
Posts: 106 Joined: Thu Apr 26, 2007 2:40 pm
Location: CSE-SUST
Contact:
Post
by sapnil » Tue Feb 26, 2008 12:41 pm
To AcmNightivy
For samle input output must be:
Code: Select all
"R
Ie
n
te
h
iD
ne
kc
,a
r
tt
he
es
r
eo
fn
oc
re
e
s
Ia
i
ad
m,
.
"
but your code returns:
Code: Select all
"R
Ie
n
te
h
iD
ne
kc
,a
r
tt
he
es
r
eo
fn
oc
re
e
s
Ia
i
ad
m,
.
"
Thanks
sapnil
Keep posting
"Dream Is The Key To Success"
@@@ Jony @@@
AcmNightivy
New poster
Posts: 36 Joined: Tue Dec 04, 2007 10:20 am
Post
by AcmNightivy » Thu Feb 28, 2008 4:24 pm
i 've check my output but no extra blank in every line?why??
my output:
Code: Select all
"R
Ie
n
Te
h
iD
ne
kc
,a
r
tt
he
es
r
eo
fn
oc
re
e
s
Ia
i
ad
m,
.
"
Press any key to continue
Shr33
New poster
Posts: 3 Joined: Mon May 26, 2008 4:51 pm
Post
by Shr33 » Sat May 31, 2008 6:47 pm
Code: Select all
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s[100000],s1;int i=0,l,j,max=1;string s2[100000],temp;
while(getline(cin,s1))
{
s[i]=s1;
i++;
}l=i;
for(i=0;i<l;i++)
{
temp=s[l-1-i];
for(j=0;j<temp.length();j++)
{
s2[j]=s2[j]+temp[j];
}
if(max<=temp.length()){max=temp.length();}
}
for(i=0;i<max;i++)
{
cout<<s2[i]<<endl;
}
return 0;
}
Last edited by
Shr33 on Sat May 31, 2008 7:01 pm, edited 3 times in total.
Shr33
New poster
Posts: 3 Joined: Mon May 26, 2008 4:51 pm
Post
by Shr33 » Sat May 31, 2008 6:48 pm
I TRIED ALL THE THINGS BUT YET P.E. HELP ME PLS
my output:>>>>>>>>>>
"R
Ie
[space]n
te
h[space]
iD
ne
kc
,a
[space]r
tt
he
es
r[space]
eo
fn
oc
re
e[space]
[space]s
Ia
[space]i
ad
m,
.
"
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Mon Jun 02, 2008 10:22 am
I got wrong answer!
can any one check my input output for this..!
Code: Select all
Input:
Opu wants to say to you that,
"I am not going".
Output:
"O
Ip
[space]u
a[space]
mw
[space]a
nn
ot
ts
[space][space]
gt
oo
i[space]
ns
ga
"y
.[space]
t
o
[space]
y
o
u
[space]
t
h
a
t
,
here is the Curser
try_try_try_try_&&&
_try@try.com
This may be the address of success.
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Wed Jun 04, 2008 12:38 pm
Some one Please Have a look at my code.
Why I get WA!
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
char st[101],st2[101];
int lenst, lenst2, i,n;
while(gets(st)&&gets(st2))
{
lenst= strlen(st);lenst2=strlen(st2);
if(lenst>lenst2) n=lenst; else n=lenst2;
for(i=0;i<n;i++)
{
if(i>=lenst) printf("%c\n",st2[i]);
else if(i>=lenst2) printf("%c\n",st[i]);
else printf("%c%c\n",st2[i],st[i]);
}
}
return 0;
}
try_try_try_try_&&&
_try@try.com
This may be the address of success.
kbr_iut
Experienced poster
Posts: 103 Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:
Post
by kbr_iut » Sat Jun 07, 2008 10:46 pm
for this input:
Code: Select all
I IUT
s
Cl
I
Om
i
Tc
UU
Ir
D
Y
G
O
L
O
N
H
C
E
T
D
FN
O
Yv
Ts
I
Si
Rt
EY
V
I
N
UT
L
C
Ie
Mc
Lh
s
I
my AC code gives:
Code: Select all
IsLMIC UNIVERSITY OF TECHNOLOGY IUT OIC
hce LT Yti sv ND DrUcim l sI
I
U
T
where ur code gives:
Code: Select all
sI
I
U
T
C
l
OI
m
T
ci
IU
rU
Y
D
OG
OL
HN
EC
T
D
OF
N
Y
v
IT
s
RS
ti
VE
Y
NI
U
LT
IC
e
LM
hc
Is
I think u have misunderstood the problem.........
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................
mrmrumman
New poster
Posts: 10 Joined: Sat Jul 05, 2008 11:26 pm
Location: Dhaka
Contact:
Post
by mrmrumman » Sat Sep 06, 2008 3:26 pm
I am getting WA anyone can help?
Code: Select all
#include <stdio.h>
# include <string.h>
int main()
{
char input[105][105];
int num=0,max=0;
while(gets(input[num]))
{
if(max<strlen(input[num]))
max=strlen(input[num]);
}
for(int i=0;i<max;i++)
{
if(i>0)
printf("\n");
for(int j=num;j>=0;j--)
{
if(input[j][i]!='\t')
printf("%c",input[j][i]);
}
}
printf("\n");
return 0;
}
R|_|\/|\/|/-\|\|
mrmbdctg
New poster
Posts: 18 Joined: Sun Mar 04, 2007 7:12 am
Location: Bangladesh
Contact:
Post
by mrmbdctg » Sun Oct 05, 2008 7:48 pm
Whats the problem . I am Getting WA
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
char temp [101]="\x0", result[100][101];
int k=0,len=0,tempo,i,m,j;
/*freopen("a.out","w",stdout); */
while(gets(temp))
{
strcpy(result[k],temp);
k++;
tempo=strlen(temp);
if(tempo>len)
len=tempo;
}
m=0;
for(i=0;i<len;i++)
{
for(j=k-1;j>=0;j--)
{
printf("%c",result[j][m]);
if(j==0)m++;
}
if(i!=(len-1))
printf("\n");
}
return 0;
}
Please help me.
Thanks in advance.
mrmbdctg
New poster
Posts: 18 Joined: Sun Mar 04, 2007 7:12 am
Location: Bangladesh
Contact:
Post
by mrmbdctg » Mon Oct 06, 2008 6:38 pm
At Last Accepted . Thanks to Samiul.
Though there was some spacing problem also.
Take care
aliahmed
New poster
Posts: 24 Joined: Fri Oct 24, 2008 8:37 pm
Location: CUET, Chittagong, Bangladesh
Contact:
Post
by aliahmed » Thu Nov 13, 2008 11:45 pm
Please help me with this code i'm just getting wrong answer.
AC
Last edited by
aliahmed on Fri Nov 14, 2008 10:30 pm, edited 1 time in total.
kbr_iut
Experienced poster
Posts: 103 Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:
Post
by kbr_iut » Fri Nov 14, 2008 11:57 am
increase ur array size to
use the right format to paste code...use code tag
and dont forget to remove after AC.
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................