Saratov State University :: Online Contester


::Go
- home
- news
- register
- update personal info
- problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

::Poll
Are you registered on Codeforces?
Yes
No
What is it???

[results]

::webboard

what is test 36???
Author: Ali
ID: 061437
Problem: 302
Contest: 0
Date: 2014-03-21 01:38:31

I have WA on test 36, what is it????
Can anyone help me ?

This is my code:

# include <iostream>

using namespace std;

char to_lowercase(char ch)
{
if (ch >= 65 && ch <= 90) return ch + 32;
else return ch;
}

char to_uppercase(char ch)
{
if (ch >= 97 && ch <= 122) return ch - 32;
else return ch;
}

int main()
{
char str[1500];
int index = 0, idx = 0, modes[200], active_mode_index = 0; // 0 is default ; -1 is down ; 1 is up
modes[0] = 0;
int tag = false;
cin >> str;
while (str[index] != NULL)
{
tag = 0;
if (str[index] == '<')
{
if (str[index + 1] == '/')
{
if (str[index + 2] == 'U' && str[index + 3] == 'P' && str[index + 4] == '>')
{
if (active_mode_index != 0) active_mode_index--;
index += 4;
tag = 1;
}
if (str[index + 2] == 'D' && str[index + 3] == 'O' && str[index + 4] == 'W' && str[index + 5] == 'N' && str[index + 6] == '>')
{
if (active_mode_index != 0) active_mode_index--;
index += 6;
tag = 1;
}
}
else
{
if (str[index + 1] == 'U' && str[index + 2] == 'P' && str[index + 3] == '>')
{
active_mode_index++;
modes[active_mode_index] = 1;
index += 3;
tag = 1;
}
if (str[index + 1] == 'D' && str[index + 2] == 'O' && str[index + 3] == 'W' && str[index + 4] == 'N' && str[index + 5] == '>')
{
active_mode_index++;
modes[active_mode_index] = -1;
index += 5;
tag = 1;
}
}
}
if (!tag)
{
if (modes[active_mode_index] == 1){ str[idx] = to_uppercase(str[index]); }
if (modes[active_mode_index] == -1){ str[idx] = to_lowercase(str[index]); }
if (modes[active_mode_index] == 0) { str[idx] = str[index]; }
idx++;
}
if (str[index] != NULL) index++;
}
str[idx] = NULL;
cout << str;
return EXIT_SUCCESS;
}


see sub-tree reply to that message


::Login
Forgot password?

::News
22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553).
22.10.12 - After the start of the contest the statements in PDF will be available by the link.
23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

Server time: 2017-09-21 10:59:24Online Contester Team © 2002 - 2016. All rights reserved.