提出 #1471025


ソースコード 拡げる

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

public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		long k = sc.nextLong();

		long[] ans = new long[50];
		for (int i = 0; i < 50; i++) {
			ans[i] = 49 + k / 50;
		}

		for (int i = 0; i < k % 50; i++) {
			for (int j = 0; j < 50; j++) {
				if (j == i) {
					ans[j] += 50;
				} else {
					ans[j] -= 1;
				}
			}
		}

		pr.println(50);
		for (int j = 0; j < 50; j++) {
			if (j > 0) {
				pr.print(' ');
			}
			pr.print(ans[j]);
		}
		pr.println();
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		private boolean isPrintable(int ch) {
			return ch >= '!' && ch <= '~';
		}

		private boolean isCRLF(int ch) {
			return ch == '\n' || ch == '\r' || ch == -1;
		}

		private int nextPrintable() {
			try {
				int ch;
				while (!isPrintable(ch = br.read())) {
					if (ch == -1) {
						throw new NoSuchElementException();
					}
				}

				return ch;
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		String next() {
			try {
				int ch = nextPrintable();
				StringBuilder sb = new StringBuilder();
				do {
					sb.appendCodePoint(ch);
				} while (isPrintable(ch = br.read()));

				return sb.toString();
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		int nextInt() {
			try {
				// parseInt from Integer.parseInt()
				boolean negative = false;
				int res = 0;
				int limit = -Integer.MAX_VALUE;
				int radix = 10;

				int fc = nextPrintable();
				if (fc < '0') {
					if (fc == '-') {
						negative = true;
						limit = Integer.MIN_VALUE;
					} else if (fc != '+') {
						throw new NumberFormatException();
					}
					fc = br.read();
				}
				int multmin = limit / radix;

				int ch = fc;
				do {
					int digit = ch - '0';
					if (digit < 0 || digit >= radix) {
						throw new NumberFormatException();
					}
					if (res < multmin) {
						throw new NumberFormatException();
					}
					res *= radix;
					if (res < limit + digit) {
						throw new NumberFormatException();
					}
					res -= digit;

				} while (isPrintable(ch = br.read()));

				return negative ? res : -res;
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		long nextLong() {
			try {
				// parseLong from Long.parseLong()
				boolean negative = false;
				long res = 0;
				long limit = -Long.MAX_VALUE;
				int radix = 10;

				int fc = nextPrintable();
				if (fc < '0') {
					if (fc == '-') {
						negative = true;
						limit = Long.MIN_VALUE;
					} else if (fc != '+') {
						throw new NumberFormatException();
					}
					fc = br.read();
				}
				long multmin = limit / radix;

				int ch = fc;
				do {
					int digit = ch - '0';
					if (digit < 0 || digit >= radix) {
						throw new NumberFormatException();
					}
					if (res < multmin) {
						throw new NumberFormatException();
					}
					res *= radix;
					if (res < limit + digit) {
						throw new NumberFormatException();
					}
					res -= digit;

				} while (isPrintable(ch = br.read()));

				return negative ? res : -res;
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		float nextFloat() {
			return Float.parseFloat(next());
		}

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

		String nextLine() {
			try {
				int ch;
				while (isCRLF(ch = br.read())) {
					if (ch == -1) {
						throw new NoSuchElementException();
					}
				}
				StringBuilder sb = new StringBuilder();
				do {
					sb.appendCodePoint(ch);
				} while (!isCRLF(ch = br.read()));

				return sb.toString();
			} catch (IOException e) {
				throw new NoSuchElementException();
			}
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new NoSuchElementException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}

提出情報

提出日時
問題 D - Decrease (Contestant ver.)
ユーザ garnacha
言語 Java8 (OpenJDK 1.8.0)
得点 600
コード長 4476 Byte
結果
実行時間 73 ms
メモリ 21460 KB

ジャッジ結果

セット名 得点 / 配点 テストケース
Sample 0 / 0 example0, example1, example2, example3, example4
All 600 / 600 corner0, corner1, corner2, corner3, corner4, corner5, corner6, corner7, corner8, corner9, example0, example1, example2, example3, example4, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9
ケース名 結果 実行時間 メモリ
corner0 69 ms 20052 KB
corner1 69 ms 19668 KB
corner2 68 ms 20180 KB
corner3 72 ms 19284 KB
corner4 70 ms 19540 KB
corner5 68 ms 18132 KB
corner6 70 ms 19284 KB
corner7 70 ms 21204 KB
corner8 69 ms 19284 KB
corner9 69 ms 21460 KB
example0 69 ms 18260 KB
example1 69 ms 19540 KB
example2 70 ms 19028 KB
example3 69 ms 19412 KB
example4 70 ms 18900 KB
rand0 67 ms 17748 KB
rand1 69 ms 21332 KB
rand2 69 ms 18004 KB
rand3 68 ms 19668 KB
rand4 73 ms 19028 KB
rand5 69 ms 19284 KB
rand6 70 ms 19412 KB
rand7 69 ms 21332 KB
rand8 70 ms 17108 KB
rand9 69 ms 17876 KB