I'm getting a TLE in SUMTHING from the INOI Practice Server... Here's my C++ source code: include "iostream"include "cmath"include "string"include "algorithm"using namespace std; int main() {
} PLEASE HELP ME SPEED IT UP... asked 05 Jan '15, 20:21

Hey, I'll give you a quick hint: think of it as a dynamic programming problem. For each position onwards in the input number, you store the least number of '+' required to get a sum from 0 to T. You do this from the end to the beginning. The answer would be the least number of '+' required from position 0 onwards, to make a sum of 'T'. Cheers! answered 05 Jan '15, 22:25
tnx...@idraumr!!! I'll try it out as soon as I wake up!!!
(05 Jan '15, 22:35)

@idraumr: Plz. find out what's wrng in the 0/1 tiles (iarcs online judge) solution of mine Here it is: include "iostream"include "algorithm"using namespace std; int main() { int n; cin >> n; long long int x[n+1]; x[0]=1; x[1]=2; for (int p = 2; p<=n1; p++) { x[p]=x[p1]+x[p2]; } cout << x[n1]%15746; return 0; } answered 05 Jan '15, 22:42
I think you should have made a new thread out of this. Anyway, the answer starts from the 3rd element of the fibonacci sequence. Try finding out the answer for small input numbers. 50 or so. That, in itself, is a large number. For larger input values, the answer quickly goes out of the range of a 64bit signed integer. The fix is simple. Change the loop's body to Cheers!
(05 Jan '15, 23:13)
thanks @idraumr It worked...
(06 Jan '15, 23:31)

I received a score of 30...