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

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

I have stupid WA2??? Can you give me some tests?
Послано Alibi 13 ноя 2015 09:19
Here is my code:
# include <bits/stdc++.h>

using namespace std;

string s[300];

string conv(int x) {
    string str;
    while(x) {
        str.push_back(x % 10 + '0');
        x /= 20;
    }
    reverse(str.begin(), str.end());
    return str;
}

int main() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= i; j++) {
            s[i] += "sin(" + conv(j);
            if(j != i) {
                if(j % 2)
                    s[i].push_back('-');
                else
                    s[i].push_back('+');
            }
        }
        for(int j = 1; j <= i; j++)
            s[i].push_back(')');
    }

    for(int i = 1; i < n; i++) cout << '(';
    for(int i = 1; i <= n; i++) {
        cout << s[i] << '+' << n - i + 1;
        if(i != n)
            cout << ')';
    }
    cout << endl;
    return 0;
}

Edited by author 13.11.2015 09:37

Edited by author 13.11.2015 09:37
Re: I have stupid WA2??? Can you give me some tests?
Послано Jane Soboleva (SumNU) 13 ноя 2015 13:07
Here you go.

9
((((((((sin(1)+9)sin(1-sin(2))+8)sin(1-sin(2+sin(3)))+7)sin(1-sin(2+sin(3-sin(4))))+6)sin(1-sin(2+sin(3-sin(4+sin(5)))))+5)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6))))))+4)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7)))))))+3)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7-sin(8))))))))+2)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7-sin(8+sin(9)))))))))+1
Re: I have stupid WA2??? Can you give me some tests?
Послано Nikita Manovich 13 окт 2017 02:12
11
((((((((((sin(1)+11)sin(1-sin(2))+10)sin(1-sin(2+sin(3)))+9)sin(1-sin(2+sin(3-sin(4))))+8)sin(1-sin(2+sin(3-sin(4+sin(5)))))+7)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6))))))+6)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7)))))))+5)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7-sin(8))))))))+4)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7-sin(8+sin(9)))))))))+3)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7-sin(8+sin(9-sin(10))))))))))+2)sin(1-sin(2+sin(3-sin(4+sin(5-sin(6+sin(7-sin(8+sin(9-sin(10+sin(11)))))))))))+1
Re: I have stupid WA2??? Can you give me some tests?
Послано jim 11 мар 2018 19:30
thank you very much! you help me a lot!