結果
問題 |
No.222 引き算と足し算
|
ユーザー |
![]() |
提出日時 | 2017-06-28 22:18:35 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 1,658 ms |
コンパイル使用メモリ | 74,552 KB |
実行使用メモリ | 53,284 KB |
最終ジャッジ日時 | 2024-10-04 14:59:55 |
合計ジャッジ時間 | 4,288 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 RE * 12 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; class Main { static PrintWriter out = new PrintWriter(System.out); static String str; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); br.close(); int index = str.indexOf("+"); if (index > 0) { System.out.println(Integer.parseInt(str.substring(0, index)) - Integer.parseInt(str.substring(index + 1))); }else{ index=str.indexOf("-"); System.out.println(Integer.parseInt(str.substring(0, index)) + Integer.parseInt(str.substring(index + 1))); } } }