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 1404. Easy to Hack!

Only latin letters???
Posted by AndryS 30 Jun 2007 03:41
Also what here it is wrong??? You see only latin letters!!
using System;
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            if (s != null)
            {
               int[] s1 = new int[s.Length];
                int[] s3 = new int[s.Length];
                string s2 = "abcdefghijklmnopqrstuvwxyz";
                int tmp = 26;
                for (int i = 0; i < s.Length; i++)
                {
                    if (i == 0)
                    {
                        s1[i] = s2.IndexOf(s[i]);
                        if (s1[i] <= 4)
                        {
                            s1[i] += 26;
                        }
                    }
                    else
                    {
                        s1[i] = s2.IndexOf(s[i]);
                        while (s1[i] < s1[i - 1])
                        {
                            s1[i] += tmp;
                        }
                    }
                }
                tmp = s1[1];
                int tmp1;
                s1[1] -= s1[0];
                for (int i = 2; i < s1.Length; i++)
                {
                    tmp1 = s1[i];
                    s1[i] -= tmp;
                    tmp = tmp1;
                }

                s = "";
                s1[0] -= 5;
                for (int i = 0; i < s1.Length; i++)
                {
                    s += s2[s1[i]];
                }
                           }
           Console.WriteLine(s);

        }
    }