結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
jp_ste
|
| 提出日時 | 2016-05-10 17:22:46 |
| 言語 | Java (openjdk 27 + ACL) |
| 結果 |
RE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 851 bytes |
| 記録 | |
| コンパイル時間 | 2,351 ms |
| コンパイル使用メモリ | 85,824 KB |
| 実行使用メモリ | 45,160 KB |
| 最終ジャッジ日時 | 2026-10-11 22:53:34 |
| 合計ジャッジ時間 | 4,238 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 RE * 1 |
ソースコード
import java.util.Scanner;
public class Main2 {
public static void main(String[] args) {
try (Scanner scan = new Scanner(System.in)) {
String S = scan.next();
String strList[] = S.split("\\*|\\+");
int list[] = new int[strList.length];
for(int i=0; i<list.length; i++) {
list[i] = Integer.parseInt(strList[i]);
}
int count = 1;
for(int i=0; i<S.length(); i++) {
char ch = S.charAt(i);
if(ch == '*') {
list[0] = list[0] + list[count];
count++;
} else if(ch == '+') {
list[0] = list[0] * list[count];
count++;
}
}
System.out.println(list[0]);
}
}
}
jp_ste