Submission #572279


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Numerics;
 
namespace Solver
{
    class Program
    {
        const int M = 1000000007;
        const double eps = 1e-9;
        static void Main()
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            var sc = new Scan();
            var s = sc.Str;
            if (!s.Contains('!'))
            {
                if (s.Length % 2 == 0)
                    sw.WriteLine();
                else
                    sw.WriteLine('-');
 
                sw.Flush();
                return;
            }
            int a = calc(s, 0);
            int b = calc(s, 1);
            switch (a)
            {
                case -1:
                    switch (b)
                    {
                        case 0:
                            sw.WriteLine("-!");
                            break;
                    }
                    break;
                case 0:
                    switch (b)
                    {
                        case -1:
                            sw.WriteLine("-!!");
                            break;
                        case 1:
                            sw.WriteLine("!!");
                            break;
                    }
                    break;
                case 1:
                    switch (b)
                    {
                        case 0:
                            sw.WriteLine("!");
                            break;
                    }
                    break;
            }
            sw.Flush();
        }
        static int calc(string s, int p)
        {
            int ret = p;
            for (int i = s.Length - 1; i >= 0; i--)
            {
                if (s[i] == '-')
                    ret = -ret;
                else
                    ret = (ret == 0) ? 1 : 0;
            }
            return ret;
        }
    }
    class Scan
    {
        public int Int { get { return int.Parse(Console.ReadLine().Trim()); } }
        public long Long { get { return long.Parse(Console.ReadLine().Trim()); } }
        public string Str { get { return Console.ReadLine().Trim(); } }
        public int[] IntArr { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); } }
        public int[] IntArrWithSep(char sep) { return Console.ReadLine().Trim().Split(sep).Select(int.Parse).ToArray(); }
        public long[] LongArr { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); } }
        public double[] DoubleArr { get { return Console.ReadLine().Split().Select(double.Parse).ToArray(); } }
        public string[] StrArr { get { return Console.ReadLine().Trim().Split(); } }
        public List<int> IntList { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToList(); } }
        public List<long> LongList { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToList(); } }
        public void Multi(out int a, out int b) { var arr = IntArr; a = arr[0]; b = arr[1]; }
        public void Multi(out int a, out int b, out int c) { var arr = IntArr; a = arr[0]; b = arr[1]; c = arr[2]; }
        public void Multi(out int a, out int b, out int c, out int d) { var arr = IntArr; a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
        public void Multi(out int a, out string b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1]; }
        public void Multi(out int a, out int b, out string c) { var arr = StrArr; a = int.Parse(arr[0]); b = int.Parse(arr[1]); c = arr[2]; }
        public void Multi(out int a, out char b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1][0]; }
        public void Multi(out char a, out int b) { var arr = StrArr; a = arr[0][0]; b = int.Parse(arr[1]); }
        public void Multi(out long a, out long b) { var arr = LongArr; a = arr[0]; b = arr[1]; }
        public void Multi(out long a, out int b) { var arr = LongArr; a = arr[0]; b = (int)arr[1]; }
        public void Multi(out string a, out string b) { var arr = StrArr; a = arr[0]; b = arr[1]; }
    }
    class mymath
    {
        int M;
        const double eps = 1e-9;
        public mymath(int M) { this.M = M; }
        public long pow(long a, long b)
        {
            if (b == 0) return 1;
            if (b == 1) return a % M;
 
            long t = pow(a, b / 2);
 
            if ((b & 1) == 0) return t * t % M;
            else return t * t % M * a % M;
        }
        public long gcd(long a, long b)
        {
            while (b != 0)
            {
                var t = a % b;
                a = b;
                b = t;
            }
            return a;
        }
        public long lcm(int a, int b) { return (a * b) / gcd(a, b); }
    }
}

Submission Info

Submission Time
Task E - ショートコーディング
User riantkb
Language C# (Mono 3.2.1.0)
Score 100
Code Size 4952 Byte
Status AC
Exec Time 163 ms
Memory 9644 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 32
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt
Case Name Status Exec Time Memory
01-01.txt AC 136 ms 9572 KB
01-02.txt AC 133 ms 9584 KB
01-03.txt AC 127 ms 9548 KB
01-04.txt AC 127 ms 9612 KB
01-05.txt AC 129 ms 9548 KB
01-06.txt AC 138 ms 9576 KB
01-07.txt AC 139 ms 9556 KB
01-08.txt AC 128 ms 9496 KB
01-09.txt AC 133 ms 9584 KB
01-10.txt AC 130 ms 9588 KB
01-11.txt AC 136 ms 9596 KB
01-12.txt AC 128 ms 9608 KB
01-13.txt AC 163 ms 9520 KB
01-14.txt AC 141 ms 9612 KB
01-15.txt AC 143 ms 9540 KB
01-16.txt AC 144 ms 9616 KB
01-17.txt AC 137 ms 9644 KB
01-18.txt AC 126 ms 9608 KB
01-19.txt AC 132 ms 9568 KB
01-20.txt AC 131 ms 9572 KB
01-21.txt AC 132 ms 9540 KB
01-22.txt AC 121 ms 9608 KB
01-23.txt AC 125 ms 9584 KB
01-24.txt AC 125 ms 9564 KB
01-25.txt AC 125 ms 9608 KB
01-26.txt AC 123 ms 9516 KB
01-27.txt AC 123 ms 9604 KB
01-28.txt AC 123 ms 9612 KB
01-29.txt AC 126 ms 9508 KB
sample-01.txt AC 126 ms 9608 KB
sample-02.txt AC 126 ms 9612 KB
sample-03.txt AC 125 ms 9608 KB