結果
問題 |
No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
|
ユーザー |
|
提出日時 | 2017-08-17 00:49:32 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 289 ms / 3,000 ms |
コード長 | 2,115 bytes |
コンパイル時間 | 4,258 ms |
コンパイル使用メモリ | 106,880 KB |
実行使用メモリ | 22,912 KB |
最終ジャッジ日時 | 2024-12-25 17:19:29 |
合計ジャッジ時間 | 7,349 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
コンパイルメッセージ
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 System.Text; using System.Threading.Tasks; namespace SandboxCSharp { class Solver { void Solve() { int n = io.ScanInt(); long z = 0; for (int i = 0; i < n; ++i) { z += io.ScanLong(); } io.Write(z); } // ================================================= // ================================================= Stdio io; static void Main() { new Solver(); } Solver(Stdio _io = null) { io = _io == null ? new Stdio() : io; Solve(); } } class Stdio { protected string[] stack = new string[0]; protected int stackptr = 0; public virtual int ScanInt() { return Check() ? int.Parse(stack[stackptr++]) : 0; } public virtual long ScanLong() { return Check() ? long.Parse(stack[stackptr++]) : 0; } public virtual string ScanString() { return Check() ? stack[stackptr++] : string.Empty; } public virtual double ScanDouble() { return Check() ? double.Parse(stack[stackptr++]) : 0; } protected virtual bool Check() { if (stackptr < stack.Length) return true; var l = Console.ReadLine(); if (l == null) return false; stack = l.Split(' ').ToArray(); stackptr = 0; return Check(); } public Stdio Write(long v) { Console.Write($"{v}"); return this; } public Stdio WriteLn(long v) { Console.WriteLine($"{v}"); return this; } public Stdio Write(string str) { Console.Write(str); return this; } public Stdio WriteLn(string str = "") { Console.WriteLine(str); return this; } } }