2

Educational Codeforces Round 140 Editorial

 1 year ago
source link: https://codeforces.com/blog/entry/110225
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Educational Codeforces Round 140 Editorial

By awoo, history, 20 hours ago, translation,

1767A - Cut the Triangle

Idea: BledDest

Tutorial
Solution (BledDest)

1767B - Block Towers

Idea: BledDest

Tutorial
Solution (awoo)

1767C - Count Binary Strings

Idea: BledDest

Tutorial
Solution (BledDest)

1767D - Playoff

Idea: Neon

Tutorial
Solution (Neon)

1767E - Algebra Flash

Idea: BledDest

Tutorial
Solution (awoo)

1767F - Two Subtrees

Idea: shnirelman

Tutorial
Solution (shnirelman)

19 hours ago, # |

I have become an Expert thanks to this contest! Great D by the way.

19 hours ago, # |

Rev. 2  

0

In problem A, since the first line is empty. I read it as a string and never bothered to use it. It WA'd. This is my submission 185477892 . After the contest, I didn't even bother to read the first line and used the same code as above and it got AC. I am not sure why and could use some help.185647398

  • 16 hours ago, # ^ |

    cin >> [whatever] doesn't work as you think. The input data is split into tokens: a token is a sequence of characters. Tokens are separated by whitespaces (incl. normal spaces and newline characters). Doing cin >> [whatever] reads the next token* and tries to convert it into the type of the variable. Doing cin >> [whatever] always skips over any spaces and newline characters. Thus, your cin >> s reads the first integer into your string, messing up the values. In order to read a full line into a single string (including all spsces, but not the newline character) you need to do the following:

    string s;
    getline(cin, s);

    *doing cin >> [char] only reads the next character, but it still skips whitespaces.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK