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

why Compilation error
Posted by Nima Naderi 12 Aug 2019 13:00
my code:
#include<bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 2*1e6+3;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5];


string num(ll n){
    string ans="";
    while(n){
        ans=(char)(n%10+'0')+ans;
        n/=10;
    }
    return ans;
}

string An(ll t,ll n){
    string a=num(t);
    if(t==n){
        return "sin("+a+")";
    }
    if(t%2==1){
        return "sin("+a+"-"+An(t+1,n)+")";
    }
    return "sin("+a+"+"+An(t+1,n)+")";
}
string Sn(ll t,ll n){
    string a=num(n-t+1);
    if(t==1){
        return An(1,1)+"+"+a;
    }
    return "("+Sn(t-1,n)+")"+An(1,t)+"+"+a;
}
int main(){
    fast_io
    //file_io
    ll n;
    cin >> n;
    string answer=Sn(n,n);
    cout << answer;
    return 0;
}

Edited by author 12.08.2019 13:01
Re: why Compilation error
Posted by Nima Naderi 12 Aug 2019 13:13
i find out its because of language of compiler
use G++ 7.1 for c++ :)