結果
| 問題 | 
                            No.222 引き算と足し算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ルッツファン
                         | 
                    
| 提出日時 | 2015-11-28 04:38:59 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,620 bytes | 
| コンパイル時間 | 3,356 ms | 
| コンパイル使用メモリ | 77,100 KB | 
| 実行使用メモリ | 52,140 KB | 
| 最終ジャッジ日時 | 2024-11-15 22:07:34 | 
| 合計ジャッジ時間 | 6,216 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 9 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("\\+");
			
			System.out.println(tes.indexOf("\\-"));
			
			char[] er = tes.toCharArray();
			int tmpp = 0;
			for(int i=0;i<tes.length();i++){
				if(er[i] == '-'){
					tmpp++;
				}
			}
			
			if(rew.length == 2){
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				
				System.out.println(a-b);
				return;
			}
			if(tmpp == 1){
				
				rew = tes.split("\\-");
				
				int a = Integer.parseInt(rew[0]);
				int b = Integer.parseInt(rew[1]);
				System.out.println(a+b);
				return;
				
			}else if(tmpp == 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(tmpp == 1 && er[0] == '-'){
				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;
			}
			
			
			
	}
}
            
            
            
        
            
ルッツファン