10071 - Back to High School Physics
Moderator: Board moderators
I would simply dokeceman 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
Code: Select all
while(cin >> v >> t){
...
}
When cin fails to send values to v (or t), it returns an empty stream.
10071 Wa !?
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;
}
I don't believe it....
It specifies the 2 inputs are integers,
and so it is......
Why..................................................
(echo)
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.
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.
My signature:
- Please make discussion about the algorithm BRFORE posting source code.
We can learn much more in discussion than reading source code. - I HATE testing account.
- Don't send me source code for debug.
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);
}
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.
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.
My signature:
- Please make discussion about the algorithm BRFORE posting source code.
We can learn much more in discussion than reading source code. - I HATE testing account.
- Don't send me source code for debug.
-
- Learning poster
- Posts: 98
- Joined: Sat Jan 21, 2006 12:45 pm
- Location: Busan,Corea(Republic of)
1 2 -> 4
3 4 -> 24
5 6 -> 60
7 8 -> 112
9 0 -> 0
3 4 -> 24
5 6 -> 60
7 8 -> 112
9 0 -> 0
Archaan
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
-
- Learning poster
- Posts: 98
- Joined: Sat Jan 21, 2006 12:45 pm
- Location: Busan,Corea(Republic of)
you must use long long inteager
Archaan
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
-
- Learning poster
- Posts: 98
- Joined: Sat Jan 21, 2006 12:45 pm
- Location: Busan,Corea(Republic of)
long long int...
Archaan
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!