結果

問題 No.222 引き算と足し算
ユーザー kou6839kou6839
提出日時 2015-06-06 00:29:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 652 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 74,668 KB
実行使用メモリ 54,520 KB
最終ジャッジ日時 2024-04-27 17:25:59
合計ジャッジ時間 7,145 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
53,944 KB
testcase_01 AC 123 ms
54,092 KB
testcase_02 AC 123 ms
54,288 KB
testcase_03 AC 109 ms
52,964 KB
testcase_04 AC 121 ms
54,028 KB
testcase_05 AC 122 ms
54,032 KB
testcase_06 AC 121 ms
54,128 KB
testcase_07 AC 123 ms
54,520 KB
testcase_08 AC 121 ms
54,064 KB
testcase_09 AC 124 ms
53,864 KB
testcase_10 AC 123 ms
54,116 KB
testcase_11 AC 124 ms
54,104 KB
testcase_12 AC 125 ms
54,104 KB
testcase_13 AC 123 ms
54,192 KB
testcase_14 AC 121 ms
54,172 KB
testcase_15 AC 109 ms
52,908 KB
testcase_16 AC 123 ms
53,944 KB
testcase_17 AC 125 ms
54,172 KB
testcase_18 AC 121 ms
53,992 KB
testcase_19 AC 122 ms
54,092 KB
testcase_20 AC 123 ms
53,716 KB
testcase_21 AC 121 ms
53,892 KB
testcase_22 AC 121 ms
53,932 KB
testcase_23 AC 127 ms
54,272 KB
testcase_24 AC 124 ms
54,080 KB
testcase_25 AC 122 ms
54,164 KB
testcase_26 AC 122 ms
53,840 KB
testcase_27 AC 121 ms
54,056 KB
testcase_28 AC 120 ms
54,068 KB
testcase_29 AC 124 ms
54,148 KB
testcase_30 AC 110 ms
52,852 KB
testcase_31 AC 122 ms
54,084 KB
testcase_32 AC 124 ms
54,092 KB
testcase_33 AC 124 ms
54,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args){
        // TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int p = 0;
        for(int i=1;i<in.length();i++){
        	if(!Character.isDigit(in.charAt(i))){
        		p=i;
        		break;
        	}
        }
        int a = Integer.parseInt(in.substring(0, p));
        int b = Integer.parseInt(in.substring(p+1, in.length()));
        if(in.charAt(p)=='-'){
        	System.out.println(a+b);
        }else{
        	System.out.println(a-b);
        }
    }
}
0