結果

問題 No.265 数学のテスト
ユーザー GrenacheGrenache
提出日時 2015-08-07 23:10:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,304 bytes
コンパイル時間 3,401 ms
コンパイル使用メモリ 75,972 KB
実行使用メモリ 56,720 KB
最終ジャッジ日時 2023-09-25 06:17:33
合計ジャッジ時間 10,517 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
56,648 KB
testcase_01 AC 318 ms
56,196 KB
testcase_02 WA -
testcase_03 AC 161 ms
55,956 KB
testcase_04 AC 164 ms
55,768 KB
testcase_05 AC 186 ms
56,344 KB
testcase_06 AC 164 ms
55,760 KB
testcase_07 AC 193 ms
56,600 KB
testcase_08 AC 187 ms
56,552 KB
testcase_09 AC 165 ms
55,732 KB
testcase_10 AC 158 ms
55,500 KB
testcase_11 AC 186 ms
56,328 KB
testcase_12 AC 132 ms
55,608 KB
testcase_13 AC 146 ms
55,740 KB
testcase_14 AC 145 ms
55,960 KB
testcase_15 AC 129 ms
55,888 KB
testcase_16 AC 146 ms
55,740 KB
testcase_17 AC 132 ms
55,888 KB
testcase_18 AC 129 ms
55,600 KB
testcase_19 AC 138 ms
56,076 KB
testcase_20 AC 140 ms
55,792 KB
testcase_21 AC 134 ms
55,724 KB
testcase_22 AC 149 ms
55,636 KB
testcase_23 AC 135 ms
55,776 KB
testcase_24 AC 130 ms
55,916 KB
testcase_25 AC 161 ms
55,732 KB
testcase_26 AC 135 ms
55,880 KB
testcase_27 AC 135 ms
55,520 KB
testcase_28 AC 145 ms
55,356 KB
testcase_29 AC 131 ms
55,468 KB
testcase_30 AC 138 ms
55,808 KB
testcase_31 AC 133 ms
55,780 KB
testcase_32 AC 132 ms
55,836 KB
testcase_33 AC 132 ms
56,156 KB
testcase_34 AC 130 ms
55,504 KB
testcase_35 AC 130 ms
55,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder265 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt() + 1;
        int d = sc.nextInt();
        char[] s = (sc.next() + "+").toCharArray();
        
        int[] a = new int[d + 1];

        int cc = 0;
        int dd = 0;
        int xx = 0;
        for (int i = 0; i < n; i++) {
        	char e = s[i];
        	
        	if (e >= '1' && e <= '9') {
        		cc = e - '0';
        	} else if (e == 'x') {
        		xx++;
        		if (cc == 0) {
        			cc = 1;
        		}
        	} else if (cc != 0 && (e == '+' || e == '}')) {
        		for (int j = 0; j < dd; j++) {
        			cc *= xx;
        			xx--;
        		}
        		if (xx >= 0) {
        			a[xx] += cc;
        		}
        		cc = 0;
        		xx = 0;
        		if (e == '}') {
        			dd--;
        		}
        	} else if (e == '}') {
        		dd--;
        	} else if (e == 'd') {
        		dd++;
        	} else if (e == '*') {
        	} else if (e == '{') {
        	}
        }

        for (int i = 0; i < d + 1; i++) {
        	if (i > 0) {
        		System.out.print(" ");
        	}
        	System.out.print(a[i]);
        }
        System.out.println("");

        sc.close();
    }
}
0