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

Обсуждение задачи 1149. Танцы синуса

Who can help,Why I am always wrong
Послано kkk 12 апр 2002 10:40
#include<stdio.h>
void A(int i)
{ int n;

   for(n=1;n<i;n++)
   printf("sin(%d+",n);
   printf("sin(%d",i);
 for(n=1;n<=i;n++)
   printf(")");
 }
void S(int i)
{ int n;
  for(n=1;n<i;n++)
   printf("(");
  for(n=1;n<i;n++)
  { A(n);
    printf("+%d)",i-n+1);
    }
  A(i);
  printf("+1");
  }
main()
 { int n;
   scanf("%d",&n);
   S(n);
   }
You have made a very little mistake....
Послано Vladimir Milenov Vasilev 13 апр 2002 04:56
>Hei, it is OK your pogram, just have a look at the sample output -
you have to change the sign "+" and "-" - your program outputs just
sign "+" - you have to change the sign each time - that is it.
I think, you will get accepted - TRY IT!!!!!
Re: You have made a very little mistake....
Послано kkk 13 апр 2002 14:19
Thank you for your information.But I still misunderstand your meaning
Please explain more details
                    Thanks Again!!!
Hei, have a look at the semple output...
Послано Vladimir Milenov Vasilev 13 апр 2002 15:35
As I saw our program, you for n=3 your putput is:
((sin(1)+3)sin(1+sin(2))+2)sin(1+sin(2+sin(3)))+1
But have a look at the sample putput - it is:
((sin(1)+3)sin(1-sin(2))+2)sin(1-sin(2+sin(3)))+1
The signs "+" and "-" !!!
Your program outputs just "+"!!!!!!
TEst your program and the sample outout - you'l see!
If you haven't anderstood me,write me again...
Bye!
Re: Who can help,Why I am always wrong
Послано Frankie 26 ноя 2011 09:41
> I am always wrong
Sounds like a logical fallacy, lol :D "i'm lying"
Re: Who can help,Why I am always wrong
Послано Anatoly 30 янв 2012 23:06
Just change 5th line from
printf("sin(%d+",n);
to
printf("sin(%d%c", n, n & 1 ? '-' : '+');