Submission #7464941


Source Code Expand

Copy
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        BExactlyNPoints solver = new BExactlyNPoints();
        solver.solve(1, in, out);
        out.close();
    }

    static class BExactlyNPoints {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt();

            int m = 1;
            while (m * (m + 1) / 2 < n) m++;
            int diff = m * (m + 1) / 2 - n;

            for (int i = 1; i <= m; i++) {
                if (i == diff) continue;
                out.printLine(i);
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }
}

Submission Info

Submission Time
Task B - Exactly N points
User amotoma3
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 3709 Byte
Status
Exec Time 90 ms
Memory 21332 KB

Judge Result

Set Name Score / Max Score Test Cases
sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
dataset1 200 / 200 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt
dataset2 100 / 100 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 73 ms 19284 KB
01-02.txt 70 ms 18004 KB
01-03.txt 72 ms 19284 KB
01-04.txt 72 ms 18516 KB
01-05.txt 72 ms 18388 KB
01-06.txt 70 ms 18644 KB
01-07.txt 70 ms 21332 KB
01-08.txt 72 ms 15956 KB
01-09.txt 72 ms 18900 KB
01-10.txt 70 ms 18260 KB
02-01.txt 90 ms 21332 KB
02-02.txt 77 ms 17748 KB
02-03.txt 90 ms 19668 KB
02-04.txt 78 ms 19028 KB
02-05.txt 88 ms 18644 KB
02-06.txt 77 ms 21332 KB
02-07.txt 85 ms 18900 KB
02-08.txt 88 ms 19412 KB
sample-01.txt 72 ms 17364 KB
sample-02.txt 70 ms 19156 KB
sample-03.txt 72 ms 19284 KB