10055 - Hashmat the Brave Warrior

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

Moderator: Board moderators

Post Reply
Carunty
New poster
Posts: 18
Joined: Sat Jul 08, 2006 2:40 am

Post by Carunty »

thank you.

I change the code, just do the absolute value by coding.
ajoker
New poster
Posts: 1
Joined: Sun Oct 22, 2006 5:13 pm

10055 - WA

Post by ajoker »

Code: Select all

#include <stdio.h>
long long int a, b;
int main(){
    while(scanf("%lld%lld", &a, &b)==2)
        if(a>b)printf("%lld\n", a - b);
        else printf("%lld\n", b - a);
}
This program got WA, why?
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

First thing is dont open a new thread if one (at least) already exists.
And second thing is there is no error in the code (1 warning). So, it should get accepted. Make sure that you are submitting it correctly.
Ami ekhono shopno dekhi...
HomePage
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:

Post by newton »

Code: Select all


   deleted

Last edited by newton on Sat Jul 14, 2007 1:10 pm, edited 2 times in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

newton wrote:hey man that is your 1st submission. nothing to worry about it.
try to change the condition to

Code: Select all

while(scanf(%lld %lld,&a,&b)==2)
to

Code: Select all

while(scanf(%ld %ld ,&a ,&b)!=EOF)

Code: Select all

while(scanf(%lld %lld,&a,&b)==2)
is enough. And just submit the code in C++. There is no error in the code.
Ami ekhono shopno dekhi...
HomePage
hf_1992
New poster
Posts: 4
Joined: Sat Nov 11, 2006 6:44 am

10055 in Pascal WA

Post by hf_1992 »

Would anyone tell me that what's wrong with my code?

Code: Select all

program VolumeC_10055;
var n1,n2:longword;
begin
readln(n1,n2);
writeln(abs(n1-n2));
eof(input)
end.
seulkiro
New poster
Posts: 6
Joined: Sun Feb 15, 2004 2:13 am
Location: Canada
Contact:

Post by seulkiro »

I had to use long long for input in C++. I had a wrong answer when I used int. The problem might be data type you are using. BTW, I'm not familiar with Pascal.
waikiki..
hasibul_DIU
New poster
Posts: 1
Joined: Sat Dec 30, 2006 8:40 am
Location: 2-H/9-17 Dhaka Bangladesh
Contact:

10055

Post by hasibul_DIU »

/*10055*/
#include<stdio.h>

void main(){
long h,o;
while(scanf("%ld %ld",&h,&o)!=EOF){
printf("%ld\n",o-h);}
}


I do not find my mistake.
please help me

e-mail: hasibul2363@yahoo.com
Last edited by hasibul_DIU on Wed Mar 28, 2007 11:12 am, edited 1 time in total.
shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA

Post by shamim »

Two mistakes:

1) you assume that the second number will always be higher, this is always not the case.
2) long data type will not do, use double.
MAK
New poster
Posts: 28
Joined: Sun Oct 23, 2005 3:44 pm
Location: Dhaka, Bangladesh

double?

Post by MAK »

I think I solved it with long long (C++) instead of double. But double works too I guess.
atm
New poster
Posts: 2
Joined: Sun Jan 21, 2007 2:33 pm

10055

Post by atm »

how come we can't use the fixed manipulator from the iomanip library, to avoid getting the output in scientific notation??
any clue about solving this problem?
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Search your peoblem first. Dont open a new thread if one already exists.
Ami ekhono shopno dekhi...
HomePage
starrynight
New poster
Posts: 7
Joined: Mon Mar 05, 2007 3:24 pm

HELP !I STILL GOT A WA!

Post by starrynight »

int main()
{
long long int num1 ,num2,answer;


while(scanf("%lld %lld",&num1,&num2) != EOF)
{
if(num1 > num2)
{
answer = num1 - num2;
printf("%lld\n",answer);
}
else
{
answer = num2 - num1;
printf("%lld\n",answer);
}

}


return 0;
}

I wrote this in C!
why I still got a WA~?
thx! :o
Debashis Maitra
Learning poster
Posts: 62
Joined: Sun Jul 09, 2006 8:31 am
Location: University of Dhaka
Contact:

Post by Debashis Maitra »

starrynight
i cannt find anything wrong with your code

its same to my code

but i submitted my code in C++

you can try this

that may help you

best of luck :lol:
Akash chhoyar swopno
Dream to touch the sky
sv90
New poster
Posts: 17
Joined: Wed Feb 01, 2006 8:27 pm
Location: Dhaka,Bangladesh

10055 how can i!

Post by sv90 »

how can i lessen my run time and use of memory. in this problem it use 1.146..
Post Reply

Return to “Volume 100 (10000-10099)”