1252 - The Seven Percent Solution

Discussion around the problems of the COJ.
Forum rules
Remember that posting AC code is not allowed here. If you are going to ask a question or to post a solution, describe your algorithm instead. Posting AC code will be penalized.
Post Reply
User avatar
dovier
Posts: 1097
Joined: 7 years ago
Location: Havana, Cuba
Gender: Male
Cuba

1252 - The Seven Percent Solution

Post by dovier » 6 years ago




dpaladin
Posts: 4
Joined: 2 years ago
Gender: None specified

Re: 1252 - The Seven Percent Solution

Post by dpaladin » 2 years ago

Using getline(cin, s), reading characters and printing directly. Even tried ios_base::sync_with_stdio(0). Still TLE with C++11.

Can somebody help me understand what's happening. Am i missing something?

HaZard
Posts: 115
Joined: 4 years ago
Location: Camagüey - Cuba
Gender: Male
Contact:
Cuba

Re: 1252 - The Seven Percent Solution

Post by HaZard » 2 years ago

intenta leyendo los caracteres uno por uno, no debe hacer mucha diferencia, pero inténtalo de todas formas...
teruel

User avatar
isaac
Posts: 83
Joined: 3 years ago
Gender: None specified

Re: 1252 - The Seven Percent Solution

Post by isaac » 2 years ago

Señores, con lo facil que es leer un char* con el gets...es bien cómodo. Si luego lo quieres trabajar como un string, solamente creas el string y le pasas el char* que leiste como parametro al constructor. Algo asi:

char line[1001];
string s;

int main() {

gets(line);
s = string(line);

}

Post Reply

Return to “Problem set”