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 1149. Sinus Dances

I have stupid WA2??? Can you give me some tests?
Posted by Alibi 13 Nov 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?
Posted by Jane Soboleva (SumNU) 13 Nov 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?
Posted by Nikita Manovich 13 Oct 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?
Posted by jim 11 Mar 2018 19:30
thank you very much! you help me a lot!