結果
問題 |
No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
|
ユーザー |
|
提出日時 | 2022-09-30 22:13:30 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 1,374 bytes |
コンパイル時間 | 2,530 ms |
コンパイル使用メモリ | 77,324 KB |
実行使用メモリ | 51,108 KB |
最終ジャッジ日時 | 2024-12-22 23:57:15 |
合計ジャッジ時間 | 4,794 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
import java.io.*; class Main{ public static void main(String[] args)throws IOException{ SimpleScanner sc = new SimpleScanner(System.in); int N = sc.nextInt(); long answer = 0; while(N-->0){ answer += sc.nextLong(); } System.out.println(answer); } } /*//////////////////////////////////////////////// * My Scanner * @auther viral *///////////////////////////////////////////////// class SimpleScanner{ final private int buff_size = 1<<12; private InputStream is; private byte[] buff; private int point,length; public SimpleScanner(InputStream is){ this.is = is; buff = new byte[buff_size]; point = length = 0; } private void reload()throws IOException{ do{ length = is.read(buff,point = 0,buff_size); }while(length==-1); } private byte read()throws IOException{ if(point==length)reload(); return buff[point++]; } public int nextInt()throws IOException{ int ans = 0; byte c = read(); while(c<=' ')c = read(); boolean negate = c == '-'; if(c=='-')c = read(); while('0'<=c&&c<='9'){ ans = ans*10+c-'0'; c = read(); } return negate ? -ans : ans; } public long nextLong()throws IOException{ long ans = 0; byte c = read(); while(c<=' ')c = read(); boolean negate = c == '-'; if(c=='-')c = read(); while('0'<=c&&c<='9'){ ans = ans*10+c-'0'; c = read(); } return negate ? -ans : ans; } }