xicheng
BAN USERI am a grad student at University at Buffalo.
string to_dollar(int amount){
stringstream ss;
ss << amount;
string result;
ss >> result;
int count = (result.size()%3 ==0)? result.size()/3-1: result.size()/3 ;
int counter = 0;
for( int i = 1; i <= count; i++){
result.insert(result.size()-i*3 - counter, ",");
counter++;
}
result.insert(0,"$");
return result;
}
This is correct, set a two-day frame. And use intent-sell, intent-buy marks. eg. 3 7 4 10 11 8 5 4 8
[3 ,7], buy at 3.
[7, 4], mark 4 as intent-sell
[4, 10], sell at 4, and mark it as intent-buy
[10,11] buy 10! and mark 11 as intent-sell
[11,8] sell at 11 and mark 8 as intent-buy
[8,5] cancel intent-buy at 8.
[5,4] do nothing
[4,8] buy at 4, sell at 8
3 cuts into 1 segment each
- xicheng March 21, 20131st: cut into 4&3.
2nd: put 3 onto 4. cut at 2. Now we have 3 two-segment and 1 one-segment.
3nd: put 3 two-segment onto a stack, cut at 1.