ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1654. Cipher Message

WA 1
Posted by dula 24 Apr 2013 22:36
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
    char in[200000];
    int num ;
    char c;
    scanf("%c",&c);
    char nc = c;
    if(c == '\n')
    goto end;
    in[0] = c;
    for(num=1;;num++)
    {
        scanf("%c",&c);
        if(c == '\n')
        break;
        if(nc == c)
        {
           in[num-1] = '\0';
           num -= 2;
           if((num+1) != 0)
            nc = in[num];
                   else
                        nc = '\0';

        }
        else
        {
           in[num] = c;
           nc = c;
        }

    }
end:
        for(int i=0;i<=num;i++)
    cout << in[i];

}
Re: WA 1
Posted by dula 24 Apr 2013 23:52
got a 0.109s answer..


Edited by author 24.04.2013 23:52