結果
問題 | No.9000 Hello World! (テスト用) |
ユーザー | camypaper |
提出日時 | 2014-10-21 17:09:37 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 23 ms / 5,000 ms |
コード長 | 13,288 bytes |
コンパイル時間 | 4,715 ms |
コンパイル使用メモリ | 116,336 KB |
実行使用メモリ | 17,152 KB |
最終ジャッジ日時 | 2024-11-13 22:21:09 |
合計ジャッジ時間 | 1,655 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 23 ms
17,152 KB |
testcase_01 | AC | 22 ms
17,152 KB |
testcase_02 | AC | 22 ms
17,152 KB |
testcase_03 | AC | 23 ms
17,024 KB |
コンパイルメッセージ
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.Generic; using System.Linq; using Solver.Ex; using Watch = System.Diagnostics.Stopwatch; using StringBuilder = System.Text.StringBuilder; namespace Solver { public class Solver { public void Solve() { IO.Printer.Out.PrintLine("Hello World!"); } internal IO.StreamScanner sc; } #region Main and Settings static class Program { static void Main(string[] arg) { #if DEBUG var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite); System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream")); System.Diagnostics.Debug.AutoFlush = false; var sw = new Watch(); sw.Start(); try { #endif var solver = new Solver(); solver.sc = new IO.StreamScanner(Console.OpenStandardInput()); IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); solver.Solve(); IO.Printer.Out.Flush(); #if DEBUG } catch (Exception ex) { Console.Error.WriteLine(ex.Message); Console.Error.WriteLine(ex.StackTrace); } finally { sw.Stop(); Console.ForegroundColor = ConsoleColor.Green; Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds); System.Diagnostics.Debug.Close(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); } #endif } } #endregion } #region IO Helper namespace Solver.IO { public class Printer { static Printer() { Out = new Printer(Console.Out); } public static Printer Out { get; set; } private readonly System.IO.TextWriter writer; private readonly System.Globalization.CultureInfo info; public string Separator { get; set; } public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? "\n"; } } public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null) { writer = tw ?? System.IO.TextWriter.Null; info = ci ?? System.Globalization.CultureInfo.InvariantCulture; NewLine = newLine; Separator = separator ?? " "; } public void Print(int num) { writer.Write(num.ToString(info)); } public void Print(int num, string format) { writer.Write(num.ToString(format, info)); } public void Print(long num) { writer.Write(num.ToString(info)); } public void Print(long num, string format) { writer.Write(num.ToString(format, info)); } public void Print(double num) { writer.Write(num.ToString("F12", info)); } public void Print(double num, string format) { writer.Write(num.ToString(format, info)); } public void Print(string str) { writer.Write(str); } public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); } public void Print<T>(string format, IEnumerable<T> sources) { writer.Write(format, sources.OfType<object>().ToArray()); } public void Print(IEnumerable<char> sources) { writer.Write(sources.AsString()); } public void Print<T>(IEnumerable<T> sources) { var res = new System.Text.StringBuilder(); foreach (var x in sources) { res.AppendFormat(info, "{0}", x); if (string.IsNullOrEmpty(Separator)) res.Append(Separator); } writer.Write(res.ToString(0, res.Length - Separator.Length)); } public void PrintLine() { writer.WriteLine(); } public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); } public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); } public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); } public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); } public void PrintLine(double num) { writer.WriteLine(num.ToString("F12", info)); } public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); } public void PrintLine(string str) { writer.WriteLine(str); } public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); } public void PrintLine<T>(string format, IEnumerable<T> sources) { writer.WriteLine(format, sources.OfType<object>().ToArray()); } public void PrintLine<T>(IEnumerable<T> sources) { var res = new StringBuilder(); foreach (var x in sources) { res.AppendFormat(info, "{0}", x); if (!string.IsNullOrEmpty(Separator)) res.Append(Separator); } writer.WriteLine(res.ToString(0, res.Length - Separator.Length)); } public void Flush() { writer.Flush(); } } public class StreamScanner { public StreamScanner(System.IO.Stream stream) { iStream = stream; } private readonly System.IO.Stream iStream; private readonly byte[] buf = new byte[1024]; private int len, ptr; private bool eof = false; public bool EndOfStream { get { return eof; } } private byte readByte() { if (eof) throw new System.IO.EndOfStreamException(); if (ptr >= len) { ptr = 0; len = iStream.Read(buf, 0, 1024); if (len <= 0) { eof = true; return 0; } } return buf[ptr++]; } private bool inSpan(byte c) { const byte lb = 33, ub = 126; return !(c >= lb && c <= ub); } private byte skip() { byte b = 0; do b = readByte(); while (!eof && inSpan(b)); return b; } public char Char() { return (char)skip(); } public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = (char)skip(); return a; } public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; } public string Scan() { const byte lb = 33, ub = 126; if (eof) throw new System.IO.EndOfStreamException(); do { while (ptr < len && (buf[ptr] < lb || ub < buf[ptr])) { ptr++; } if (ptr < len) break; ptr = 0; len = iStream.Read(buf, 0, 1024); if (len <= 0) { eof = true; return null; } continue; } while (true); StringBuilder sb = null; do { var i = ptr; while (i < len) { if (buf[i] < lb || ub < buf[i]) { string s; if (sb != null) { sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr)); s = sb.ToString(); } else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr)); ptr = i + 1; return s; } i++; } i = len - ptr; if (sb == null) sb = new StringBuilder(i + 32); sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i)); ptr = 0; } while ((len = iStream.Read(buf, 0, 1024)) > 0); eof = true; return sb.ToString(); } public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; } public string ScanLine() { const byte el = 10, cr = 13; if (eof) throw new System.IO.EndOfStreamException(); StringBuilder sb = null; do { var i = ptr; while (i < len) { if (buf[i] == cr || buf[i] == el) { string s; if (sb != null) { sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr)); s = sb.ToString(); } else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr)); if (buf[i] == cr) i++; if (buf[i] == el) i++; ptr = i; return s; } i++; } i = len - ptr; if (sb == null) sb = new StringBuilder(i + 32); sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i)); ptr = 0; } while ((len = iStream.Read(buf, 0, 1024)) > 0); eof = true; return sb.ToString(); } public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); } public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; } public int Integer() { var ret = 0; byte b = 0; bool isMynus = false; const byte zero = 48, nine = 57, mynus = 45; do b = readByte(); while (!eof && !((b >= zero && b <= nine) || b == mynus)); if (b == mynus) { isMynus = true; b = readByte(); } while (true) { if (b >= zero && b <= nine) { ret = ret * 10 + b - zero; } else return isMynus ? -ret : ret; b = readByte(); } } public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; } public long Long() { long ret = 0; byte b = 0; bool isMynus = false; const byte zero = 48, nine = 57, mynus = 45; do b = readByte(); while (!eof && !((b >= zero && b <= nine) || b == mynus)); if (b == '-') { isMynus = true; b = readByte(); } while (true) { if (b >= zero && b <= nine) ret = ret * 10 + (b - zero); else return isMynus ? -ret : ret; b = readByte(); } } public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++) a[i] = Long(); return a; } public void Flush() { iStream.Flush(); } } } #endregion #region Extension namespace Solver.Ex { static public partial class EnumerableEx { static public string AsString(this IEnumerable<char> source) { return new string(source.ToArray()); } static public string AsJoinedString<T>(this IEnumerable<T> source, string separator = " ") { return string.Join(separator, source); } static public T[] Enumerate<T>(this int n, Func<int, T> selector) { var res = new T[n]; for (int i = 0; i < n; i++) res[i] = selector(i); return res; } } } #endregion