### seven_triple's blog

By seven_triple, history, 3 months ago, ,
#include<bits/stdc++.h>

using namespace std;

string c = "";
a = string(b.length()-a.length(),'0') + a;
//cout<<"a = "<<a<<"b = "<<b<<"\n";
int carry = 0;
for(int i=b.length()-1;i>=0;--i){
int x = a[i]-'0',y = b[i]-'0';
int z = x+y+carry;
c = to_string(z%10) + c;
carry = z/10;
}
if(carry){
c = to_string(carry) + c;
}
return c;
}

int main(){
vector<int >cache = {1};
string a = "1",b = "1";
int index = 2,prev = 1;
while(cache.size() <= 5000){
index++;
a = b;
b = c;
//  cout<<c<<"\n";

int curr = c.length();
if(curr > prev){
cache.push_back(index);
}
prev = curr;
}

int t;
cin>>t;
while(t--){
int n;
cin>>n;
cout<<cache[n-1]<<"\n";
}
return 0;
}



• 0

By seven_triple, history, 9 months ago, ,

I want to replace all the ? in range l to r with 'A' 1. first i am using function but it not working means not replacing the ? 2. second i am using for loop instead the function inside the main function and it is working correct .I am not able to understand why this happen.

all the suitable information are given in below code using comments.

Thanks.