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 1000. A+B Problem

problem 1000 (a+b)
Posted by wardun 21 Mar 2013 17:28
why wrong answer?



#include<stdio.h>
int main()
{float a,b,sum;
printf("a:");scanf("%f",&a);
printf("b:");scanf("%f",&b);
sum=a+b;
printf("a+b:%f",sum);
return 0;}
Re: problem 1000 (a+b)
Posted by Imposter 1 Apr 2013 15:27
Even i got the wrong answer .
On a glance at your code if you give input as 1 and c ( letter ) you get a result 39 .which according to the problem statement is incorrect. It is concerned about addition of number so add test cases like checking whether input is valid for program .

Edited by author 01.04.2013 15:28
Re: problem 1000 (a+b)
Posted by Majin Boo 31 Oct 2015 21:35
You mustn't print any prompts. For example: "a: " or "b: ". Also you only must make the sum of two INTEGER numbers. Is no necessary to use float, only use int.
Re: problem 1000 (a+b)
Posted by Demenev Dmitriy 15 Feb 2016 22:34
+
Re: problem 1000 (a+b)
Posted by ToadMonster 16 Feb 2016 14:40
http://acm.timus.ru/help.aspx?topic=judge&locale=en
Input data in the test cases always satisfy the constraints described in the problem statement. You don’t need to verify these constraints in your solutions.

No reason to wait input "1 c".
Re: problem 1000 (a+b)
Posted by ToadMonster 16 Feb 2016 14:43
You have been already informed that no prompts allowed.

Another note - are you sure you can use "float" type?
In example (http://acm.timus.ru/help.aspx?topic=cpp) int is used instead. Float has less mantissa size - can be WA on big integers (big means "> 2^24").

Checked your solution locally and via online judge - answer for test is "6.000000", expected answer is 6, WA1.

Edited by author 16.02.2016 14:48