Submission #350233
Source Code Expand
using System; using System.IO; using System.Linq; using System.Text; using System.Diagnostics; using System.Collections.Generic; using System.Text.RegularExpressions; using Enu = System.Linq.Enumerable; class Program { void Solve() { var S = reader.String(); var ans = ""; foreach (Match m in Regex.Matches(S, "(.)\\1*")) ans += m.Groups[1].ToString() + m.Length; Console.WriteLine(ans); } Reader reader = new Reader(Console.In); static void Main() { new Program().Solve(); } } class Reader { private readonly TextReader reader; private readonly char[] separator = { ' ' }; private readonly StringSplitOptions removeOp = StringSplitOptions.RemoveEmptyEntries; private string[] A = new string[0]; private int i; public Reader(TextReader r) { reader = r; } public Reader(string file) { reader = new StreamReader(file); } public bool HasNext() { return Enqueue(); } public string String() { return Dequeue(); } public int Int() { return int.Parse(Dequeue()); } public long Long() { return long.Parse(Dequeue()); } public double Double() { return double.Parse(Dequeue()); } public int[] IntLine() { var s = Line(); return s == "" ? new int[0] : Array.ConvertAll(Split(s), int.Parse); } public int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); } public int[][] IntGrid(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); } public string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Line()).ToArray(); } public string Line() { return reader.ReadLine().Trim(); } private string[] Split(string s) { return s.Split(separator, removeOp); } private bool Enqueue() { if (i < A.Length) return true; string line = reader.ReadLine(); if (line == null) return false; if (line == "") return Enqueue(); A = Split(line); i = 0; return true; } private string Dequeue() { Enqueue(); return A[i++]; } }
Submission Info
Submission Time | |
---|---|
Task | B - 高橋くんと文字列圧縮 |
User | eitaho |
Language | C# (Mono 2.10.8.1) |
Score | 100 |
Code Size | 2110 Byte |
Status | AC |
Exec Time | 232 ms |
Memory | 10628 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
All | 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 | AC | 227 ms | 10448 KB |
1.txt | AC | 230 ms | 10628 KB |
10.txt | AC | 230 ms | 10284 KB |
11.txt | AC | 216 ms | 10308 KB |
12.txt | AC | 226 ms | 10368 KB |
13.txt | AC | 220 ms | 10388 KB |
14.txt | AC | 218 ms | 10384 KB |
15.txt | AC | 217 ms | 10244 KB |
16.txt | AC | 219 ms | 10308 KB |
17.txt | AC | 216 ms | 10384 KB |
18.txt | AC | 221 ms | 10312 KB |
19.txt | AC | 218 ms | 10384 KB |
2.txt | AC | 222 ms | 10592 KB |
20.txt | AC | 222 ms | 10360 KB |
21.txt | AC | 220 ms | 10384 KB |
22.txt | AC | 217 ms | 10376 KB |
23.txt | AC | 214 ms | 10384 KB |
24.txt | AC | 216 ms | 10316 KB |
25.txt | AC | 222 ms | 10320 KB |
26.txt | AC | 218 ms | 10384 KB |
27.txt | AC | 227 ms | 10388 KB |
28.txt | AC | 218 ms | 10316 KB |
29.txt | AC | 221 ms | 10316 KB |
3.txt | AC | 232 ms | 10524 KB |
4.txt | AC | 223 ms | 10528 KB |
5.txt | AC | 222 ms | 10524 KB |
6.txt | AC | 229 ms | 10492 KB |
7.txt | AC | 222 ms | 10516 KB |
8.txt | AC | 224 ms | 10436 KB |
9.txt | AC | 228 ms | 10524 KB |
subtask0_1.txt | AC | 216 ms | 10376 KB |
subtask0_2.txt | AC | 221 ms | 10388 KB |
subtask0_3.txt | AC | 216 ms | 10372 KB |