Submission #16754919


Source Code Expand

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        s = s.Replace("25", "A");

        long answer = 0;

        long count = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s.Substring(i, 1) == "A")
            {
                count++;
            }
            else
            {
                for (int j = 1; j <= count; j++)
                {
                    answer += j;
                }
                count = 0;
            }
        }

        for (int i = 1; i <= count; i++)
        {
            answer += i;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Submission Info

Submission Time
Task B - ニコニコ文字列
User suroyuu
Language C# (.NET Core 3.1.201)
Score 100
Code Size 2161 Byte
Status
Exec Time 97 ms
Memory 29192 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
× 5
× 18
× 30
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
Subtask1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask0_sample_05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt 78 ms 25716 KB
subtask0_sample_02.txt 81 ms 25716 KB
subtask0_sample_03.txt 90 ms 25768 KB
subtask0_sample_04.txt 79 ms 25980 KB
subtask0_sample_05.txt 87 ms 25880 KB
subtask1_01.txt 78 ms 25860 KB
subtask1_02.txt 87 ms 25788 KB
subtask1_03.txt 90 ms 25852 KB
subtask1_04.txt 79 ms 25844 KB
subtask1_05.txt 80 ms 25764 KB
subtask1_06.txt 85 ms 25844 KB
subtask1_07.txt 80 ms 26164 KB
subtask1_08.txt 76 ms 26000 KB
subtask1_09.txt 86 ms 26264 KB
subtask1_10.txt 81 ms 25756 KB
subtask1_11.txt 79 ms 25616 KB
subtask1_12.txt 87 ms 26136 KB
subtask1_13.txt 83 ms 25620 KB
subtask2_01.txt 85 ms 28520 KB
subtask2_02.txt 81 ms 28392 KB
subtask2_03.txt 92 ms 28932 KB
subtask2_04.txt 77 ms 28820 KB
subtask2_05.txt 80 ms 29192 KB
subtask2_06.txt 84 ms 28920 KB
subtask2_07.txt 86 ms 28332 KB
subtask2_08.txt 79 ms 27996 KB
subtask2_09.txt 80 ms 26276 KB
subtask2_10.txt 97 ms 26112 KB
subtask2_11.txt 85 ms 26252 KB
subtask2_12.txt 84 ms 26380 KB