Submission #347146


Source Code Expand

Copy
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    void calc()
    {
        Scanner cin = new Scanner();
        string s = cin.next();

        int count = 0;
        char pre = ' ';
        string ret = "";
        foreach (var c in s)
        {
            if (c == pre)
            {
                count++;
            }
            else
            {
                if (count != 0)
                {
                    ret += pre;
                    ret += count;
                }
                pre = c;
                count = 1;
            }
        }
        if (count != 0)
        {
            ret += pre;
            ret += count;
        }

        Console.WriteLine(ret);
    }

}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}


class XRand
{
    uint x, y, z, w;


    public XRand()
    {
        init();
    }

    public XRand(uint s)
    {
        init();
        init_xor128(s);
    }

    void init()
    {
        x = 314159265; y = 358979323; z = 846264338; w = 327950288;

    }

    public void init_xor128(uint s)
    {
        z ^= s;
        z ^= z >> 21; z ^= z << 35; z ^= z >> 4;
        z *= 736338717;
    }

    uint next()
    {
        uint t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;
    }

    public long nextLong(long m)
    {
        return (long)((((ulong)next() << 32) + next()) % (ulong)m);
    }

    public int nextInt(int m)
    {
        return (int)(next() % m);
    }

    public long nextLong(long min, long max)
    {
        return min + nextLong(max - min + 1);
    }

    public int nextInt(int min, int max)
    {
        return min + nextInt(max - min + 1);
    }

    public int nextIntP(int a)
    {
        return (int)Math.Pow(a, nextDouble());
    }

    public int nextIntP(int min, int max)
    {
        int diff = max - min;
        return min + nextIntP(diff + 2) - 1;
    }

    public long nextLongP(long a)
    {
        return (long)Math.Pow(a, nextDouble());
    }

    public long nextLongP(long min, long max)
    {
        long diff = max - min;
        return min + nextLongP(diff + 2) - 1;
    }


    public double nextDouble()
    {
        return (double)next() / uint.MaxValue;
    }

    public double nextDoubleP(double a)
    {
        return Math.Pow(a, nextDouble());
    }
}

Submission Info

Submission Time
Task B - 高橋くんと文字列圧縮
User chokudai
Language C# (Mono 2.10.8.1)
Score 100
Code Size 3286 Byte
Status
Exec Time 167 ms
Memory 7360 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_1.txt, subtask0_2.txt, subtask0_3.txt
All 100 / 100 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt
Case Name Status Exec Time Memory
0.txt 157 ms 7228 KB
1.txt 156 ms 7272 KB
10.txt 146 ms 7076 KB
11.txt 143 ms 7076 KB
12.txt 144 ms 7092 KB
13.txt 142 ms 7096 KB
14.txt 151 ms 7100 KB
15.txt 142 ms 7100 KB
16.txt 142 ms 7140 KB
17.txt 142 ms 7096 KB
18.txt 142 ms 7100 KB
19.txt 143 ms 7140 KB
2.txt 151 ms 7276 KB
20.txt 140 ms 7036 KB
21.txt 148 ms 7032 KB
22.txt 158 ms 7092 KB
23.txt 164 ms 7084 KB
24.txt 167 ms 6992 KB
25.txt 144 ms 7088 KB
26.txt 144 ms 7028 KB
27.txt 144 ms 7088 KB
28.txt 140 ms 7064 KB
29.txt 143 ms 7020 KB
3.txt 149 ms 7288 KB
4.txt 149 ms 7288 KB
5.txt 152 ms 7296 KB
6.txt 152 ms 7312 KB
7.txt 149 ms 7360 KB
8.txt 145 ms 7224 KB
9.txt 154 ms 7296 KB
subtask0_1.txt 141 ms 7080 KB
subtask0_2.txt 145 ms 7012 KB
subtask0_3.txt 152 ms 7068 KB