10197 - Learning Portuguese

All about problems in Volume 101. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

amd-RS
New poster
Posts: 27
Joined: Thu Sep 05, 2002 7:37 am

10197 - Learning Portuguese

Post by amd-RS »

Hi all,

Could you give me some test cases, I don know why I get wrong answer :cry:

Thanks, Aur
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

p10197

Post by sumankar »

it seems no one is intt in this one
me too got same problem,
we can swap codes I guess,
i/p is trivial it seems,
mail me
srbr@hotmail.com
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

10197

Post by sumankar »

#include<stdio.h>
#include<string.h>

int radical(char conj[],char *tv,char *last)
{

if ( strlen(conj) >= 2 ) {
*last = conj[strlen(conj)-1];
*tv = conj[strlen(conj)-2];
conj[strlen(conj)-2] = '\0';
return 1;
}
return -1;
}

int main()
{
char verb[31],tv,trans[31],lst;

while ( scanf("%s %s",verb,trans) == 2 ) {
printf("%s (to %s)\n",verb,trans);
radical( verb,&tv,&lst);
if( lst == 'r' && (tv == 'a' || tv == 'e' || tv == 'i') ) {
printf("eu %so\n",verb);
printf("tu %s%cs\n",verb,tv=='i'?'e':tv);
printf("ele/ela %s%c\n",verb,tv=='i'?'e':tv);
printf("n%cs %s%cmos\n",243,verb,tv);
printf("v%cs %s%c%cs\n",243,verb,tv,tv=='i'?'\0':'i');
printf("eles/elas %s%cm\n",verb,tv=='i'?'e':tv);
}
else printf("Unknown conjugation\n");
printf("\n");
}
return 0;
}

Code: Select all

[c]

whats wrong 
someone plz plz help me,
thnx in advance[/c]
Daredevil
New poster
Posts: 19
Joined: Tue Apr 01, 2003 7:47 am
Location: Earth

10197

Post by Daredevil »

#include<stdio.h>
#include<string.h>
int l,c;
char v1[50],v2[50],t;
void main(){
while(scanf("%s",&v1)!=EOF){
gets(v2);
printf("%s (to%s)\n",v1,v2);
l=strlen(v1)-1;
if(v1[l]=='r'){
if(v1[l-1]=='a'||v1[l-1]=='e'||v1[l-1]=='i') {
t=v1[l-1];v1[l-1]=0;
if(t=='i') c=1;
}
}
if(!v1[l-1]){
printf("eu %so\n",v1);
if(!c){
printf("tu %s%cs\n",v1,t);
printf("ele/ela %s%c\n",v1,t);
printf("n%cs %s%cmos\n",243,v1,t);
printf("v%cs %s%cis\n",243,v1,t);
printf("eles/elas %s%cm",v1,t);
}
else {
printf("tu %ses\n",v1);
printf("ele/ela %se\n",v1);
printf("n%cs %s%cmos\n",243,v1,t);
printf("v%cs %s%cs\n",243,v1,t);
printf("eles/elas %sem",v1);c=0;
}
}
else printf("Unknown conjugation");
printf("\n\n");
}
}[/c]
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

10197 :please help me I'm, frustrated !!

Post by sumankar »

give me a hint
at least

what can be a tricky i/p?? javascript:emoticon(':(')
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

10197:Portuguese Verbs et al

Post by sumankar »

Just what am I supposed to do
in order to get someone (yes someone!!)
help me out a little bit?
Nobody seems to be bothered by this problem.

Please !!
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

Hmm.
It helps to place this question in the right forum.
Try to get someone's attention by asking the right question :). Just asking for help or plainly dumping WA code will trigger no one. State what you already got and where specificly your problem lies.
Or you can always PM people high in the rankings, but there the same applies as in the forums. They get quite a lot of help requests, so your question's got to sick out somehow to get answered.
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

10197

Post by sumankar »

Thnx joey.

Well I tried the forum.
Twice , lots of views but replies = 0 .
So i got freaked out a little.

Sorry if I ve offended anyone.

My problem is :
is there some sort of nasty i/o (the input set )
that is hard to come up with for someone like me
who's new into this kind of coding that might crash the
program .The problem hardly seems like one.

1)i do a getline to incorporate verbs wiith spaces.
2)no idea what to print for a blank line(so i print a blank line)
3) since no special symbols are used(prob desc)
what else can fail it with a WA??

Thnx in advance
(last time I'm misusing this thread javascript:emoticon(':wink:'))
suman.
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

I don't think there's any dirty input.
1) looks good
2) I don't take care of blank lines, so they're probably not there, but I handle more than one space between the protuguese and english verb (don't know if there are such cases).
3) no special symbols are used in the input, but the output contains ascii 243

PM me your code if you want me to take a look at it.
playerX
Learning poster
Posts: 63
Joined: Fri Apr 25, 2003 11:57 pm
Location: Coimbra, Portugal

Post by playerX »

hi, I got this accepted, but I also went a bit mad.

I don't know if this is happening to you but this was my mistake:

verb: amar
(it would be a well formed verb)

verb: amav
(it should be invalid)

I was just checking the character before the last and wasn't making sure the last needed to be 'r', hope this helps.

* I'm Portuguese :P
sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

10197

Post by sumankar »

well i was a little less lazy :D

i check last two chars

anyway how does it matter if the verb is, say
(wiith due apologies to portuguese grammaticians!!)
amarar?

BTW:i have a very li'll knowledge of french(i banked on that)
suman.
playerX
Learning poster
Posts: 63
Joined: Fri Apr 25, 2003 11:57 pm
Location: Coimbra, Portugal

Post by playerX »

well, no special cases here, "amarar" has no sense in portuguese but no special case is defined on the statement...

make sure you are using the right character on those "
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

10197 WA

Post by sohel »

HI,
This problem looks straight forward but I keep getting WA. Can somebody give me any critical inputs. Thanks.
Joseph Kurniawan
Experienced poster
Posts: 136
Joined: Tue Apr 01, 2003 6:59 am
Location: Jakarta, Indonesia

Post by Joseph Kurniawan »

Hi sohel,
there's no critical input for this prob. Maybe you should show your code so I can examine it!! :wink: :wink:
There are 3 things one need to be successful : motivation, ability and chance. And if you're a believer, make it four : God's will.
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Thanks!

Post by sohel »

I finally got AC.
My problem was that I consdered two lettered portugese words as having no conjugation. But in this program this is not so.
I guess those who knows portugese found this problem very easy.

But thanks anyway , Joseph.

---------------------------------------------------------------------------
Those who memorizes (without understanding) does well in exams, but suffers in ACM programs. But it is the problem solving ability that counts.
Post Reply

Return to “Volume 101 (10100-10199)”