結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー | 古寺いろは |
提出日時 | 2016-10-29 00:19:24 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 4,802 bytes |
コンパイル時間 | 1,168 ms |
コンパイル使用メモリ | 109,992 KB |
実行使用メモリ | 26,148 KB |
最終ジャッジ日時 | 2024-05-03 18:57:35 |
合計ジャッジ時間 | 15,470 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 26 ms
18,176 KB |
testcase_03 | AC | 25 ms
23,816 KB |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 25 ms
23,952 KB |
testcase_07 | AC | 26 ms
24,208 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | AC | 26 ms
23,952 KB |
testcase_14 | RE | - |
testcase_15 | AC | 26 ms
26,012 KB |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | AC | 26 ms
23,980 KB |
testcase_19 | AC | 25 ms
26,008 KB |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | AC | 26 ms
25,864 KB |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 26 ms
23,960 KB |
testcase_28 | AC | 26 ms
23,948 KB |
testcase_29 | RE | - |
testcase_30 | AC | 25 ms
24,088 KB |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | WA | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 26 ms
23,944 KB |
testcase_39 | RE | - |
testcase_40 | AC | 27 ms
24,084 KB |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | AC | 26 ms
23,856 KB |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | RE | - |
testcase_50 | AC | 26 ms
23,968 KB |
testcase_51 | RE | - |
testcase_52 | RE | - |
testcase_53 | RE | - |
testcase_54 | AC | 27 ms
26,020 KB |
testcase_55 | RE | - |
testcase_56 | RE | - |
testcase_57 | RE | - |
testcase_58 | AC | 26 ms
26,016 KB |
testcase_59 | RE | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | AC | 26 ms
24,092 KB |
testcase_63 | RE | - |
testcase_64 | RE | - |
testcase_65 | AC | 26 ms
21,936 KB |
testcase_66 | RE | - |
testcase_67 | AC | 27 ms
23,840 KB |
testcase_68 | WA | - |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | RE | - |
testcase_72 | RE | - |
testcase_73 | RE | - |
testcase_74 | RE | - |
testcase_75 | RE | - |
testcase_76 | WA | - |
testcase_77 | RE | - |
testcase_78 | RE | - |
testcase_79 | AC | 26 ms
23,972 KB |
testcase_80 | RE | - |
testcase_81 | AC | 27 ms
23,968 KB |
testcase_82 | RE | - |
testcase_83 | RE | - |
testcase_84 | AC | 26 ms
24,080 KB |
testcase_85 | AC | 27 ms
25,888 KB |
testcase_86 | RE | - |
testcase_87 | RE | - |
testcase_88 | AC | 25 ms
24,116 KB |
testcase_89 | AC | 25 ms
23,700 KB |
testcase_90 | AC | 28 ms
23,692 KB |
testcase_91 | AC | 25 ms
24,028 KB |
testcase_92 | AC | 25 ms
22,068 KB |
testcase_93 | WA | - |
testcase_94 | AC | 25 ms
23,844 KB |
testcase_95 | RE | - |
testcase_96 | RE | - |
testcase_97 | RE | - |
testcase_98 | AC | 26 ms
24,104 KB |
testcase_99 | RE | - |
testcase_100 | RE | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; class Iroha { public Iroha() { } public static int Main() { new Iroha().calc(); return 0; } Scanner cin; long x, y, z; //こういう分かりにくい出力ってあんまり良くないと思いますよ? string NG = "mourennaihasimasenn"; void calc() { cin = new Scanner(); x = cin.nextLong(); y = cin.nextLong(); z = cin.nextLong(); long p = 0, q = 0; if (z == 0) { Console.WriteLine(""); return; } if(x == 0 && y == 0) { Console.WriteLine(NG); return; } if(x == 0) { if(z % y == 0 && z / y < 5001) { StringBuilder tsb = new StringBuilder(); tsb.Append('w'); for (int i = 1; i < z / y; i++) { tsb.Append("wC"); } Console.WriteLine(tsb.ToString()); } else Console.WriteLine(NG); return; } if (y == 0) { if (z % x == 0 && z / x < 5001) { StringBuilder tsb = new StringBuilder(); tsb.Append('c'); for (int i = 1; i < z / x; i++) { tsb.Append("cC"); } Console.WriteLine(tsb.ToString()); } else Console.WriteLine(NG); return; } extgcd(x, y, ref p, ref q); long g = gcd(x, y); if(z % g != 0) { Console.WriteLine(NG); return; } p *= (z / g); q *= (z / g); throw new Exception("errorcheck"); //return; while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p + (y / g) * 10000) + Math.Abs(q - (x / g) * 10000)) { p += (y / g) * 10000; q -= (x / g) * 10000; } while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p - (y / g) * 10000) + Math.Abs(q + (x / g) * 10000)) { p -= (y / g) * 10000; q += (x / g) * 10000; } while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p + y / g) + Math.Abs(q - x / g)) { p += y / g; q -= x / g; } while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p - y / g) + Math.Abs(q + x / g)) { p -= y / g; q += x / g; } StringBuilder sb = new StringBuilder(); int WCount = 0; int firstadd = 0; while (sb.Length <= 10000 && p < 0) { sb.Append('c'); WCount++; p++; } while (sb.Length <= 10000 && q < 0) { sb.Append('w'); WCount++; q++; } while (sb.Length <= 10000 && p > 0) { sb.Append('c'); if (firstadd != 0) { sb.Append('C'); } else firstadd++; p--; } while (sb.Length <= 10000 && q > 0) { sb.Append('w'); if (firstadd != 0) { sb.Append('C'); } else firstadd++; q--; } sb.Append(new string('W', WCount)); if (sb.Length > 10000) Console.WriteLine(NG); else Console.WriteLine(sb.ToString()); } //swap void swap<T>(ref T a, ref T b) { T c = a; a = b; b = c; } long gcd(long a, long b) { return b != 0 ? gcd(b, a % b) : a; } long lcm(long a, long b) { return a * b / gcd(a, b); } // a x + b y = gcd(a, b) long extgcd(long a, long b, ref long x, ref long y) { long g = a; x = 1; y = 0; if (b != 0) { g = extgcd(b, a % b, ref y, ref x); y -= (a / b) * x; } return g; } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }