ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1000. A+B Problem

problem 1000 (a+b)
Послано wardun 21 мар 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)
Послано Imposter 1 апр 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)
Послано Majin Boo 31 окт 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)
Послано Demenev Dmitriy 15 фев 2016 22:34
+
Re: problem 1000 (a+b)
Послано ToadMonster 16 фев 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)
Послано ToadMonster 16 фев 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