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

shubham whats wrong!!!!! Everything is right [3] // Problem 1293. Eniya 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;
}
Majin Boo Re: whats wrong!!!!! Everything is right // Problem 1293. Eniya 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);
ToadMonster Re: whats wrong!!!!! Everything is right // Problem 1293. Eniya 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?
Peng Wang Re: whats wrong!!!!! Everything is right // Problem 1293. Eniya 14 Mar 2016 05:42
The main problem is in "||". You should use "&&" anyway. Otherwise, the shortpath magic happens.