結果

問題 No.3108 Luke or Bishop
ユーザー ぷとら
提出日時 2025-04-18 21:15:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 1,808 ms
コンパイル使用メモリ 193,128 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-18 21:16:02
合計ジャッジ時間 2,893 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, y;
  cin >> x >> y;
  int A=x-y;
  if(A%2==1){
  	if(x>=0 && y>=0){
  		cout<< x+y<<endl;
  	}
  	if(x>=0 && y<0){
  		cout<< x-y << endl;
  	}
  	if(x<0 && y>=0){
  		cout<< y-x <<endl;
  	}
  	else{
  		cout<<0-y-x <<endl;
  	}
  }
  else{
	if(x>=0 && y>=0){
  		if(x>=y){
  			cout<< x <<endl;
  		}
  		else{
  			cout<<y<<endl;
  		}
  	}
  	if(x>=0 && y<0){
  		if(x>=0-y){
  			cout<< x <<endl;
  		}
  		else{
  			cout<<0-y<<endl;
  		}
  	}
  	if(x<0 && y>=0){
  		if(0-x>=y){
  			cout<< 0-x <<endl;
  		}
  		else{
  			cout<<y<<endl;
  		}
  	}
  	else{
  		if(x>=y){
  			cout<< 0-y <<endl;
  		}
  		else{
  			cout<<0-x<<endl;
  		}
  	}
  }
}
0