답안 #114323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
114323 2019-05-31T22:19:17 Z caoash Nadan (COCI18_nadan) Java 11
0 / 50
86 ms 9980 KB
package problems;

import java.io.*;
import java.util.*;

/*
Solution Sketch:
*/

public class nadan {

    static final boolean stdin = true;
    static final String filename = "";
    static FastScanner br;
    static PrintWriter pw;

    public static void main(String[] args) throws IOException {

        if (stdin) {
            br = new FastScanner();
            pw = new PrintWriter(new OutputStreamWriter(System.out));
        } else {
            br = new FastScanner(filename + ".in");
            pw = new PrintWriter(new FileWriter(filename + ".out"));
        }

        X solver = new X();
        solver.solve(br, pw);
    }

    static class X {
        public void solve(FastScanner br, PrintWriter pw) throws IOException {
            int N = br.nextInt(); int K = br.nextInt();
            for(int i = 1; i < N; i++){
                pw.println(i);
                K -= i;
            }
            pw.println(K);
            pw.close();
        }

    }

    //fastscanner class
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

}
 
# 결과 실행 시간 메모리 Grader output
1 Runtime error 86 ms 9872 KB Execution failed because the return code was nonzero
2 Runtime error 80 ms 9868 KB Execution failed because the return code was nonzero
3 Runtime error 81 ms 9736 KB Execution failed because the return code was nonzero
4 Runtime error 79 ms 9876 KB Execution failed because the return code was nonzero
5 Runtime error 77 ms 9716 KB Execution failed because the return code was nonzero
6 Runtime error 81 ms 9980 KB Execution failed because the return code was nonzero
7 Runtime error 79 ms 9844 KB Execution failed because the return code was nonzero
8 Runtime error 80 ms 9876 KB Execution failed because the return code was nonzero
9 Runtime error 79 ms 9692 KB Execution failed because the return code was nonzero
10 Runtime error 79 ms 9700 KB Execution failed because the return code was nonzero