結果

問題 No.265 数学のテスト
ユーザー omuomu
提出日時 2015-08-08 23:41:58
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,246 bytes
コンパイル時間 3,074 ms
コンパイル使用メモリ 79,232 KB
実行使用メモリ 61,888 KB
最終ジャッジ日時 2023-09-25 07:21:35
合計ジャッジ時間 10,040 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 202 ms
61,432 KB
testcase_01 AC 204 ms
61,508 KB
testcase_02 WA -
testcase_03 AC 193 ms
60,020 KB
testcase_04 AC 189 ms
60,252 KB
testcase_05 AC 197 ms
58,804 KB
testcase_06 AC 195 ms
61,888 KB
testcase_07 AC 198 ms
58,492 KB
testcase_08 AC 199 ms
58,780 KB
testcase_09 AC 185 ms
59,896 KB
testcase_10 AC 187 ms
60,392 KB
testcase_11 AC 197 ms
58,772 KB
testcase_12 AC 126 ms
55,844 KB
testcase_13 AC 154 ms
55,948 KB
testcase_14 AC 153 ms
55,644 KB
testcase_15 AC 124 ms
55,460 KB
testcase_16 AC 150 ms
55,780 KB
testcase_17 AC 123 ms
55,404 KB
testcase_18 AC 123 ms
55,620 KB
testcase_19 AC 123 ms
55,936 KB
testcase_20 AC 126 ms
55,624 KB
testcase_21 AC 123 ms
55,720 KB
testcase_22 AC 152 ms
55,556 KB
testcase_23 AC 123 ms
55,700 KB
testcase_24 AC 123 ms
55,624 KB
testcase_25 AC 157 ms
57,816 KB
testcase_26 AC 124 ms
55,536 KB
testcase_27 AC 123 ms
55,772 KB
testcase_28 AC 130 ms
56,260 KB
testcase_29 AC 122 ms
56,204 KB
testcase_30 AC 137 ms
55,644 KB
testcase_31 AC 126 ms
55,676 KB
testcase_32 AC 119 ms
56,064 KB
testcase_33 AC 120 ms
55,764 KB
testcase_34 AC 120 ms
55,928 KB
testcase_35 AC 121 ms
55,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package tmp;

import java.util.Scanner;

public class Main {

	static Scanner sc;
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		solve();
	}
	static int i;
	static String s;
	static int n;
		
	static int[] scan(){
		int d[] = new int[n];
		for(int j = 0;j < n;j++)d[j] = 0;
		
		int tn = 0;
		int tv = 0;
		while(true){
			String nx;
			if(i < s.length()){
				nx = s.substring(i, i + 1) ;
			}else{
				nx = "end";
			}
			
			if(nx.equals("x")){
				if(tv == 0)tv = 1;
				tn++;
			}else
			if(nx.equals("*")){
				
			}else
			if(nx.equals("}") || nx.equals("end") || nx.equals("+")){
				d[tn] += tv;
				tn = 0;
				tv = 0;
				if(nx.equals("}"))break;
			}else
			if(i < s.length()-1 && s.substring(i, i + 2).equals("d{")){
				i += 2;
				int tmp[] = scan();
				for(int j = 1;j < n;j++){
					d[j-1] += tmp[j] * j;
				}
			}else
			{
				if(tv == 0)tv = 1;
				tv *= Integer.parseInt(nx); 
			}
			i++;
			if(nx.equals("end"))break;
		}
		
		return d;
	}
	
	static void solve(){
		int l = sc.nextInt();
		n = sc.nextInt();
		n++;
		s = sc.next();
		int[] d = new int[n];
		i = 0;
		d = scan();
		for(int j = 0;j < n;j++){
			System.out.print(d[j]);
			System.out.print(" ");
		}
		System.out.println();
	}

}
0