Page 2 of 4
Posted: Wed Mar 03, 2004 12:20 pm
by keceman
hm... actually i'm still don't understand what does
while (scanf... == 2 ) mean.. .hehehe
Posted: Wed Mar 03, 2004 12:38 pm
by keceman
ops... i finally finished it, i've changed the code into
while ((cin >> v >> t) != 0)
{
blablabla
}
although i still dont get what does the while statement mean.. heuheuheuhue
Posted: Tue Oct 26, 2004 3:50 pm
by eg_frx
keceman wrote:ops... i finally finished it, i've changed the code into
while ((cin >> v >> t) != 0)
{
blablabla
}
although i still dont get what does the while statement mean.. heuheuheuhue
I would simply do
Some explainations here:
When cin fails to send values to v (or t), it returns an empty stream.
Posted: Fri Dec 31, 2004 9:22 am
by plen
yes i do agree that the word constant is important.
i initially thought that this was a calculus problem and that integration is needed to find the distance-time function...

10071 Wa !?
Posted: Sun Jan 16, 2005 4:30 am
by Vala
Code: Select all
#include <stdio.h>
int main(int argc, char **argv)
{
int v1,t1,v2,t2;
scanf("%d %d",&v1,&t1);
printf("%d\n",2*v1*t1);
scanf("%d %d",&v2,&t2);
printf("%d",2*v2*t2);
return 0;
}
Why's that wrong ?
I don't believe it....
It specifies the 2 inputs are integers,
and so it is......
Why..................................................
(echo)
Posted: Sun Jan 16, 2005 6:52 am
by ..
Hi,
I come from the same University and department as you but I am little bit older. Go back to the course homepage to read the example of 10055(AC code, input and output) provided by your tutor. You will know why you WA.
Posted: Sun Jan 16, 2005 2:04 pm
by shamim
Vala, the problem is you are assuming that there will be exactly two test case, in reality there will be many more case and you should read until EOF.
Code: Select all
while ( scanf("%d %d",&v1,&t1) == 2 )
{
printf("%d\n",2*v1*t1);
}
Posted: Sun Jan 16, 2005 3:05 pm
by ..
I should suggest other people not reply this thread anymore in my last reply, but I forget.
As Vala is doing his homework, and him tutor is already providing enough and easy-reading info to him, he should get the answer himself.
10071
Posted: Wed Jan 19, 2005 11:27 pm
by PerHagen
???
my code is
#include <stdio.h>
#include <iostream.h>
void main ()
{int a,b ;
while(scanf("%d %d", &a ,&b)==2)
{
if (a<0) a=-a;
cout << 2*a*b<<endl;
}
}
but is w.a. i don't understand
bye
Hello
Posted: Thu Jan 20, 2005 10:38 pm
by growup
Hi, Q10071 asks for outputs of "displacement", instead of "distance".
The former is vector(signed), the latter is scalar(unsigned).

I/O
Posted: Fri Jan 21, 2005 3:10 am
by PerHagen
and what I/O for is problem???
Posted: Fri Jan 21, 2005 3:14 am
by PerHagen
ThX my error was::: a=-a !!!
bye
Posted: Tue Mar 14, 2006 10:49 am
by tmdrbs6584
1 2 -> 4
3 4 -> 24
5 6 -> 60
7 8 -> 112
9 0 -> 0
Posted: Tue Mar 14, 2006 10:49 am
by tmdrbs6584
you must use long long inteager
Posted: Tue Mar 14, 2006 10:50 am
by tmdrbs6584
long long int...