結果

問題 No.49 算数の宿題
ユーザー kou6839kou6839
提出日時 2014-12-22 23:08:03
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 451 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 74,076 KB
実行使用メモリ 56,064 KB
最終ジャッジ日時 2023-08-24 17:24:23
合計ジャッジ時間 3,975 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,692 KB
testcase_01 AC 116 ms
55,888 KB
testcase_02 RE -
testcase_03 AC 116 ms
55,836 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans=Integer.parseInt(s.charAt(0)+"");
        for(int i=1;i<s.length();i+=2){
        	if(s.charAt(i)=='*') ans += Integer.parseInt(s.charAt(i+1)+"");
        	else ans *= Integer.parseInt(s.charAt(i+1)+"");
        }
        System.out.println(ans);
        
    }
}
0