Submit | All submissions | Best solutions | Back to list |
NOCOMMEN - No comment |
Wersja polska | English version |
Your task is to remove all comments from C/C++ program.
There are 2 types of comments:
- multi-line:
/* comment */
- single-line:
// comment
However, You have to remember about the character \ which binds two consecutive lines. For example:
// this is a comment \
that's still a comment
Input
Program written in C/C++ with comments.
Warning: tests may contain characters of Ascii value greater than 127.
Output
The same program but without comments.
Warning: "Exact judge" is used in this problem, so you should not ignore any whitespaces in the output.
Example
Input:
// program which adds two numbers \ |
|
Added by: | Piotr Kąkol |
Date: | 2011-06-10 |
Time limit: | 5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
hide comments
|
||||||
2013-10-31 16:25:04 Piotr KÄ…kol
You have some problems with EOLs. E.g. for: while (...) {//
your output is: while (...) {
instead of: while (...) {
|
||||||
2013-10-31 07:40:27 primo
May we assume that the program is a valid C/C++ program? (for example, that multiline comments will be closed, and strings properly terminated). I can't think of any other scenario in which 10387700 should have failed. This is one of my test cases: puts(' \ // that\'//s not a comment \ '); puts(" \ /* nor \" is this */ \ "); // "but this is" Last edit: 2013-10-31 07:42:10 |
||||||
2011-09-29 09:23:36 Piotr KÄ…kol
@hallvabo - You're right. I added a warning. |
||||||
2011-09-29 00:37:17 Hallvard Norheim Bø
@Piotr: Thanks for the prompt help! The issue was caused by the presence of bytes in the input with ordinal value > 127. Maybe the problem description should contain a warning about this? Usually input is limited to 7-bit ASCII. |
||||||
2011-09-28 20:43:02 Piotr KÄ…kol
@hallvabo - Your program gives NZEC not for all tests, but if it does, it looks like this: Traceback (most recent call last):
Only byte and position changes in each test. |
||||||
2011-09-28 01:29:19 Hallvard Norheim Bø
@Piotr: What's wrong with my Python 3.1.2 solution? It's working fine locally and on ideone.com :/ Last edit: 2011-09-28 12:50:39 |
||||||
2011-08-10 10:28:50 Piotr KÄ…kol
The biggest input has 30300 bytes. |
||||||
2011-08-10 06:23:51 Hallvard Norheim Bø
Is there a limit on the input size? |
||||||
2011-08-09 22:06:13 Piotr KÄ…kol
Yup, "a*/". And You got TLE because of too strict time limit or just problem with loops? |
||||||
2011-08-09 19:47:51 HWK
Nested comment: /*/**/a*/ => "a*/" not "" Is it correct? |