結果
問題 | No.40 多項式の割り算 |
ユーザー | fujisu |
提出日時 | 2015-03-06 00:59:48 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,467 bytes |
コンパイル時間 | 2,426 ms |
コンパイル使用メモリ | 80,392 KB |
実行使用メモリ | 53,520 KB |
最終ジャッジ日時 | 2024-06-24 09:51:40 |
合計ジャッジ時間 | 7,866 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
51,008 KB |
testcase_01 | AC | 88 ms
52,600 KB |
testcase_02 | AC | 86 ms
51,184 KB |
testcase_03 | AC | 87 ms
51,012 KB |
testcase_04 | AC | 139 ms
53,064 KB |
testcase_05 | AC | 140 ms
53,240 KB |
testcase_06 | AC | 140 ms
53,220 KB |
testcase_07 | AC | 171 ms
53,004 KB |
testcase_08 | AC | 101 ms
51,304 KB |
testcase_09 | AC | 144 ms
53,384 KB |
testcase_10 | AC | 172 ms
53,292 KB |
testcase_11 | AC | 137 ms
53,212 KB |
testcase_12 | AC | 127 ms
53,132 KB |
testcase_13 | AC | 151 ms
53,520 KB |
testcase_14 | AC | 138 ms
53,356 KB |
testcase_15 | AC | 134 ms
53,008 KB |
testcase_16 | AC | 145 ms
53,236 KB |
testcase_17 | AC | 123 ms
52,760 KB |
testcase_18 | AC | 144 ms
53,160 KB |
testcase_19 | AC | 165 ms
53,380 KB |
testcase_20 | AC | 131 ms
53,124 KB |
testcase_21 | AC | 125 ms
53,004 KB |
testcase_22 | AC | 124 ms
52,964 KB |
testcase_23 | AC | 130 ms
53,372 KB |
testcase_24 | AC | 139 ms
53,376 KB |
testcase_25 | AC | 88 ms
50,856 KB |
testcase_26 | AC | 97 ms
51,188 KB |
testcase_27 | AC | 87 ms
50,860 KB |
testcase_28 | RE | - |
testcase_29 | AC | 85 ms
50,856 KB |
testcase_30 | AC | 85 ms
51,168 KB |
testcase_31 | AC | 85 ms
51,076 KB |
testcase_32 | AC | 86 ms
51,380 KB |
testcase_33 | AC | 98 ms
51,160 KB |
testcase_34 | AC | 87 ms
51,180 KB |
ソースコード
import java.io.IOException; import java.util.InputMismatchException; public class Main { void run() { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int[] a = sc.nextIntArray(n + 1); for (int i = n; 3 <= i; i--) { int k = a[i]; a[i] -= k; a[i - 2] += k; } int ans = 0; for (int i = 0; i < 3; i++) { if (a[i] != 0) { ans = i; } } System.out.println(ans); String tab = ""; for (int i = 0; i <= ans; i++) { System.out.print(tab + a[i]); tab = " "; } } public static void main(String[] args) { new Main().run(); } public void mapDebug(int[][] a) { System.out.println("--------map display---------"); for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { System.out.printf("%3d ", a[i][j]); } System.out.println(); } System.out.println("----------------------------" + '\n'); } class MyScanner { int read() { try { return System.in.read(); } catch (IOException e) { throw new InputMismatchException(); } } boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } boolean isEndline(int c) { return c == '\n' || c == '\r' || c == -1; } int nextInt() { return Integer.parseInt(next()); } int[] nextIntArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) array[i] = nextInt(); return array; } long nextLong() { return Long.parseLong(next()); } long[] nextLongArray(int n) { long[] array = new long[n]; for (int i = 0; i < n; i++) array[i] = nextLong(); return array; } double nextDouble() { return Double.parseDouble(next()); } double[] nextDoubleArray(int n) { double[] array = new double[n]; for (int i = 0; i < n; i++) array[i] = nextDouble(); return array; } String next() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } String[] nextStringArray(int n) { String[] array = new String[n]; for (int i = 0; i < n; i++) array[i] = next(); return array; } String nextLine() { int c = read(); while (isEndline(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndline(c)); return res.toString(); } } }