結果
| 問題 | 
                            No.222 引き算と足し算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ルッツファン
                         | 
                    
| 提出日時 | 2015-11-28 04:26:22 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,497 bytes | 
| コンパイル時間 | 3,271 ms | 
| コンパイル使用メモリ | 77,696 KB | 
| 実行使用メモリ | 48,140 KB | 
| 最終ジャッジ日時 | 2024-11-15 22:07:24 | 
| 合計ジャッジ時間 | 6,137 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 5 WA * 4 RE * 22 | 
ソースコード
package yukicoder;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class yukicoder011 {
	public static void main(String[] args){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String tes = null;
			try {
				tes = br.readLine();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			
			String[] rew = tes.split("\\+");
			if(rew.length == 2){
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				
				System.out.println(a-b);
				return;
			}
			if(tes.indexOf("\\-") == 1){
				
				rew = tes.split("\\-");
				
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				
				System.out.println(a+b);
				return;
				
			}else if(tes.indexOf("\\-") == 3){
				rew = tes.split("\\-");
				
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				
				a = -1*a;
				b = -1*b;
				
				System.out.println(a+b);
				return;
			}else if(tes.indexOf("\\-") == 1 && tes.substring(0, 0).equals("\\-") ){
				rew = tes.split("\\-");
				
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				
				a = -1*a;
				
				System.out.println(a+b);
				return;
			}else{
				rew = tes.split("\\-");
				
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				
				b = -1*b;
				
				System.out.println(a+b);
				return;
			}
			
			
			
	}
}
            
            
            
        
            
ルッツファン