ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1293. Eniya

whats wrong!!!!! Everything is right
Posted by shubham 8 Jul 2014 00:26
#include<stdio.h>

main()
{

    int n, a, b;
    int weight;

    while (scanf("%d", n) != EOF || scanf("%d", a) != EOF || scanf("%d",b) != EOF)
    {
        weight = n*a*b * 2;
        printf("%d", weight);
    }

    return 0;
}
Re: whats wrong!!!!! Everything is right
Posted by Majin Boo 10 Jan 2016 23:45
1. You should specify the return type value for the main function: int main() {}
2. Is not necessarry to read the input data until the end of stream. Just read it one time:

int n, a, b, w;
scanf("%d%d%d", &n, &a, &b);
w = n*a*b*2;
printf("%d\n", w);
Re: whats wrong!!!!! Everything is right
Posted by ToadMonster 11 Jan 2016 15:55
Please read scanf documentation. It returns count of read variables.
Also - task description means 3 and only 3 integers to read. Why did you use "while" here?
Re: whats wrong!!!!! Everything is right
Posted by Peng Wang 14 Mar 2016 05:42
The main problem is in "||". You should use "&&" anyway. Otherwise, the shortpath magic happens.