Submission #534639
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Numerics; using System.Globalization; 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 a = sc.Str; var s = new Stack<int>(); var ans = ""; foreach (var item in a) { if (item >= '0' && item <= '9') s.Push(item); else { var p = s.Pop(); var q = s.Pop(); if (p >= '0') { p -= '0'; ans += p; } if (q >= '0') { q -= '0'; ans += q; } ans += item; switch (item) { case '+': s.Push(q + p); break; case '-': s.Push(q - p); break; case '*': s.Push(q * p); break; } } } while (s.Count > 0) { var p = s.Pop(); if (p >= '0') { p -= '0'; ans += p; } } sw.WriteLine(ans); sw.Flush(); } } 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 | F - 逆ポーランド記法 |
User | riantkb |
Language | C# (Mono 3.2.1.0) |
Score | 0 |
Code Size | 4771 Byte |
Status | WA |
Exec Time | 131 ms |
Memory | 10112 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 200 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_01.txt, 00_sample_02.txt, 10_random_all_01.txt, 10_random_all_02.txt, 10_random_all_03.txt, 10_random_all_04.txt, 10_random_all_05.txt, 10_random_all_06.txt, 10_random_all_07.txt, 10_random_all_08.txt, 10_random_all_09.txt, 10_random_all_10.txt, 10_random_all_11.txt, 10_random_all_12.txt, 10_random_all_13.txt, 10_random_all_14.txt, 10_random_all_15.txt, 10_random_all_16.txt, 10_random_all_17.txt, 10_random_all_18.txt, 10_random_all_19.txt, 10_random_all_20.txt, 10_random_all_21.txt, 10_random_all_22.txt, 10_random_all_23.txt, 10_random_all_24.txt, 10_random_all_25.txt, 10_random_all_26.txt, 10_random_all_27.txt, 10_random_all_28.txt, 10_random_all_29.txt, 10_random_all_30.txt, 10_random_all_31.txt, 10_random_all_32.txt, 10_random_all_33.txt, 10_random_all_34.txt, 10_random_all_35.txt, 10_random_all_36.txt, 10_random_all_37.txt, 10_random_all_38.txt, 10_random_all_39.txt, 10_random_all_40.txt, 10_random_all_41.txt, 10_random_all_42.txt, 10_random_all_43.txt, 10_random_all_44.txt, 10_random_all_45.txt, 10_random_all_46.txt, 10_random_all_47.txt, 10_random_all_48.txt, 10_random_all_49.txt, 10_random_all_50.txt, 22_small_51.txt, 22_small_52.txt, 22_small_53.txt, 22_small_54.txt, 22_small_55.txt, 22_small_56.txt, 22_small_57.txt, 22_small_58.txt, 22_small_59.txt, 22_small_60.txt, 22_small_61.txt, 22_small_62.txt, 22_small_63.txt, 22_small_64.txt, 22_small_65.txt, 22_small_66.txt, 22_small_67.txt, 22_small_68.txt, 22_small_69.txt, 22_small_70.txt, 33_alternation_71.txt, 33_alternation_72.txt, 33_alternation_73.txt, 33_alternation_74.txt, 33_alternation_75.txt, 33_alternation_76.txt, 33_alternation_77.txt, 33_alternation_78.txt, 33_alternation_79.txt, 33_alternation_80.txt, 34_oneside_81.txt, 34_oneside_82.txt, 34_oneside_83.txt, 34_oneside_84.txt, 34_oneside_85.txt, 34_oneside_86.txt, 34_oneside_87.txt, 34_oneside_88.txt, 34_oneside_89.txt, 34_oneside_90.txt, 44_mul_91.txt, 44_mul_92.txt, 44_mul_93.txt, 44_mul_94.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 113 ms | 9984 KB |
00_sample_02.txt | AC | 111 ms | 9976 KB |
10_random_all_01.txt | AC | 108 ms | 10024 KB |
10_random_all_02.txt | AC | 112 ms | 10024 KB |
10_random_all_03.txt | AC | 110 ms | 10024 KB |
10_random_all_04.txt | WA | 112 ms | 10016 KB |
10_random_all_05.txt | WA | 114 ms | 10024 KB |
10_random_all_06.txt | AC | 112 ms | 10024 KB |
10_random_all_07.txt | AC | 115 ms | 10024 KB |
10_random_all_08.txt | WA | 117 ms | 10020 KB |
10_random_all_09.txt | WA | 112 ms | 9996 KB |
10_random_all_10.txt | AC | 115 ms | 10020 KB |
10_random_all_11.txt | WA | 117 ms | 10024 KB |
10_random_all_12.txt | WA | 122 ms | 9976 KB |
10_random_all_13.txt | WA | 118 ms | 10060 KB |
10_random_all_14.txt | AC | 131 ms | 10036 KB |
10_random_all_15.txt | WA | 119 ms | 10024 KB |
10_random_all_16.txt | WA | 116 ms | 10020 KB |
10_random_all_17.txt | WA | 117 ms | 10024 KB |
10_random_all_18.txt | WA | 112 ms | 10024 KB |
10_random_all_19.txt | WA | 115 ms | 10020 KB |
10_random_all_20.txt | WA | 116 ms | 10024 KB |
10_random_all_21.txt | WA | 116 ms | 10028 KB |
10_random_all_22.txt | WA | 115 ms | 9984 KB |
10_random_all_23.txt | WA | 120 ms | 10016 KB |
10_random_all_24.txt | WA | 117 ms | 10020 KB |
10_random_all_25.txt | WA | 115 ms | 10020 KB |
10_random_all_26.txt | WA | 116 ms | 10004 KB |
10_random_all_27.txt | WA | 115 ms | 10004 KB |
10_random_all_28.txt | WA | 116 ms | 10016 KB |
10_random_all_29.txt | WA | 115 ms | 10020 KB |
10_random_all_30.txt | WA | 115 ms | 10000 KB |
10_random_all_31.txt | WA | 115 ms | 10020 KB |
10_random_all_32.txt | WA | 115 ms | 10020 KB |
10_random_all_33.txt | WA | 113 ms | 9996 KB |
10_random_all_34.txt | WA | 114 ms | 10016 KB |
10_random_all_35.txt | WA | 113 ms | 10032 KB |
10_random_all_36.txt | WA | 112 ms | 10024 KB |
10_random_all_37.txt | WA | 112 ms | 10064 KB |
10_random_all_38.txt | WA | 113 ms | 9992 KB |
10_random_all_39.txt | WA | 113 ms | 9984 KB |
10_random_all_40.txt | WA | 113 ms | 10012 KB |
10_random_all_41.txt | WA | 112 ms | 10020 KB |
10_random_all_42.txt | WA | 113 ms | 10024 KB |
10_random_all_43.txt | WA | 113 ms | 10024 KB |
10_random_all_44.txt | WA | 113 ms | 10004 KB |
10_random_all_45.txt | WA | 114 ms | 10020 KB |
10_random_all_46.txt | WA | 112 ms | 10028 KB |
10_random_all_47.txt | WA | 113 ms | 10052 KB |
10_random_all_48.txt | WA | 112 ms | 10024 KB |
10_random_all_49.txt | WA | 113 ms | 10024 KB |
10_random_all_50.txt | WA | 113 ms | 9980 KB |
22_small_51.txt | WA | 113 ms | 10024 KB |
22_small_52.txt | WA | 112 ms | 10016 KB |
22_small_53.txt | AC | 112 ms | 10000 KB |
22_small_54.txt | WA | 112 ms | 10024 KB |
22_small_55.txt | WA | 113 ms | 10000 KB |
22_small_56.txt | AC | 113 ms | 10000 KB |
22_small_57.txt | AC | 112 ms | 10024 KB |
22_small_58.txt | WA | 117 ms | 10024 KB |
22_small_59.txt | AC | 116 ms | 10020 KB |
22_small_60.txt | WA | 114 ms | 10020 KB |
22_small_61.txt | WA | 115 ms | 10016 KB |
22_small_62.txt | WA | 114 ms | 10056 KB |
22_small_63.txt | AC | 113 ms | 10028 KB |
22_small_64.txt | AC | 116 ms | 10052 KB |
22_small_65.txt | AC | 116 ms | 10020 KB |
22_small_66.txt | AC | 114 ms | 10016 KB |
22_small_67.txt | WA | 115 ms | 9972 KB |
22_small_68.txt | WA | 114 ms | 10020 KB |
22_small_69.txt | AC | 117 ms | 9988 KB |
22_small_70.txt | AC | 116 ms | 10008 KB |
33_alternation_71.txt | WA | 117 ms | 10080 KB |
33_alternation_72.txt | WA | 113 ms | 10112 KB |
33_alternation_73.txt | WA | 109 ms | 10024 KB |
33_alternation_74.txt | WA | 112 ms | 10024 KB |
33_alternation_75.txt | WA | 112 ms | 10000 KB |
33_alternation_76.txt | WA | 112 ms | 10020 KB |
33_alternation_77.txt | WA | 110 ms | 10016 KB |
33_alternation_78.txt | WA | 115 ms | 9992 KB |
33_alternation_79.txt | WA | 111 ms | 10024 KB |
33_alternation_80.txt | WA | 113 ms | 10020 KB |
34_oneside_81.txt | WA | 112 ms | 10020 KB |
34_oneside_82.txt | WA | 118 ms | 10004 KB |
34_oneside_83.txt | WA | 114 ms | 10040 KB |
34_oneside_84.txt | WA | 111 ms | 10016 KB |
34_oneside_85.txt | WA | 112 ms | 10000 KB |
34_oneside_86.txt | WA | 111 ms | 10020 KB |
34_oneside_87.txt | WA | 112 ms | 10020 KB |
34_oneside_88.txt | WA | 114 ms | 10020 KB |
34_oneside_89.txt | WA | 115 ms | 9988 KB |
34_oneside_90.txt | WA | 113 ms | 10020 KB |
44_mul_91.txt | WA | 112 ms | 10016 KB |
44_mul_92.txt | WA | 114 ms | 10016 KB |
44_mul_93.txt | WA | 109 ms | 10020 KB |
44_mul_94.txt | WA | 112 ms | 10020 KB |