You are viewing a single comment's thread. Return to all comments →
What is wrong in this code? Not even working for smaller inputs:
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) void solve() { string a,b,res; ll n = 0; cin >> a >> b >> n; while (res.length()<n){ res= a+b; a=b; b=res; } cout<<res[n+1]<<endl; } int main() { fast_cin(); ll t; cin >> t; for (int it = 1; it <= t; it++) { solve(); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #230: Fibonacci Words
You are viewing a single comment's thread. Return to all comments →
What is wrong in this code? Not even working for smaller inputs: