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.
User avatar
dovier
Posts: 1090
Joined: Fri Nov 11, 2011 9:32 am
Location: Havana, Cuba
Gender: Male

1252 - The Seven Percent Solution

Postby dovier » Mon Feb 06, 2012 4:04 pm




dpaladin
Posts: 4
Joined: Fri Oct 21, 2016 5:38 am
Gender: None specified

Re: 1252 - The Seven Percent Solution

Postby dpaladin » Sat Oct 22, 2016 3:28 am

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: 113
Joined: Sun Feb 09, 2014 9:43 am
Location: Camagüey - Cuba
Gender: Male
Contact:

Re: 1252 - The Seven Percent Solution

Postby HaZard » Sat Oct 22, 2016 4:42 pm

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: Mon Oct 26, 2015 6:20 pm
Gender: None specified

Re: 1252 - The Seven Percent Solution

Postby isaac » Mon Oct 24, 2016 10:26 pm

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);

}


Return to “Problem set”

Who is online

Users browsing this forum: No registered users and 1 guest