結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー | 古寺いろは |
提出日時 | 2016-10-29 00:11:40 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,717 bytes |
コンパイル時間 | 981 ms |
コンパイル使用メモリ | 112,580 KB |
実行使用メモリ | 28,428 KB |
最終ジャッジ日時 | 2024-05-03 18:41:13 |
合計ジャッジ時間 | 16,429 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 25 ms
17,792 KB |
testcase_03 | AC | 25 ms
17,920 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 25 ms
17,792 KB |
testcase_07 | AC | 26 ms
17,792 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 25 ms
18,048 KB |
testcase_14 | WA | - |
testcase_15 | AC | 26 ms
17,920 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 25 ms
17,664 KB |
testcase_19 | AC | 25 ms
17,920 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 26 ms
17,792 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 26 ms
18,048 KB |
testcase_28 | AC | 27 ms
17,920 KB |
testcase_29 | WA | - |
testcase_30 | AC | 26 ms
17,920 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 26 ms
17,792 KB |
testcase_39 | WA | - |
testcase_40 | AC | 25 ms
17,920 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 25 ms
17,792 KB |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | AC | 24 ms
17,920 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | AC | 25 ms
17,920 KB |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | AC | 26 ms
17,792 KB |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | AC | 26 ms
17,920 KB |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | AC | 25 ms
17,920 KB |
testcase_66 | WA | - |
testcase_67 | AC | 25 ms
17,792 KB |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | AC | 25 ms
17,920 KB |
testcase_80 | WA | - |
testcase_81 | AC | 25 ms
17,920 KB |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | AC | 26 ms
18,048 KB |
testcase_85 | AC | 26 ms
18,048 KB |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | AC | 25 ms
17,920 KB |
testcase_89 | AC | 25 ms
18,048 KB |
testcase_90 | AC | 25 ms
18,048 KB |
testcase_91 | AC | 25 ms
17,920 KB |
testcase_92 | AC | 25 ms
17,792 KB |
testcase_93 | WA | - |
testcase_94 | AC | 27 ms
17,792 KB |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | WA | - |
testcase_98 | AC | 25 ms
18,048 KB |
testcase_99 | WA | - |
testcase_100 | WA | - |
コンパイルメッセージ
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; 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("mourennaihasimasenn"); 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("mourennaihasimasenn"); 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("mourennaihasimasenn"); return; } extgcd(x, y, ref p, ref q); long g = gcd(x, y); if(z % g != 0) { Console.WriteLine("mourennaihasimasenn"); return; } p *= (z / g); q *= (z / g); 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("mourennaihasimasenn"); 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()); } }