Submission #1311251


Source Code Expand

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

class Program
{
    static void Main(string[] args)
    {
        string a = Console.ReadLine();
        long ans =a.Length*(a.Length-1);

        for (long i = 0; i < a.Length; i++)
        {

            if (a[(int)i] == 'U')
            {
                ans += i;
            }
            else
            {
                ans += a.Length -1 - i;
            }
        }
        Console.WriteLine(ans);
    }
  public static int factorial(int n)
    {
        if (n > 0)
        {
            return n * factorial(n - 1);
        }
        else
        {
            return 1;
        }
    }
    public static Boolean uso() { return false; }
    public static int gcd(int a,int b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static int lcm(int a,int b)
    {
        return a * b / gcd(a,b);
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (int i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static long[] Ints()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Submission Info

Submission Time
Task B - Evilator
User rayhotate
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1812 Byte
Status WA
Exec Time 21 ms
Memory 13140 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 4
WA × 8
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt WA 21 ms 11232 KB
02.txt WA 21 ms 11232 KB
03.txt WA 21 ms 11232 KB
04.txt WA 20 ms 11232 KB
05.txt WA 20 ms 11232 KB
06.txt WA 20 ms 9184 KB
07.txt WA 20 ms 9184 KB
08.txt WA 20 ms 11232 KB
09.txt AC 19 ms 9044 KB
10.txt AC 20 ms 13140 KB
s1.txt AC 19 ms 9044 KB
s2.txt AC 20 ms 13140 KB