結果

問題 No.84 悪の算盤
ユーザー リチウムリチウム
提出日時 2014-12-03 00:00:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 3,313 ms
コンパイル使用メモリ 72,628 KB
実行使用メモリ 56,540 KB
最終ジャッジ日時 2023-09-02 01:15:40
合計ジャッジ時間 5,552 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,316 KB
testcase_01 AC 117 ms
56,076 KB
testcase_02 AC 116 ms
55,780 KB
testcase_03 AC 120 ms
56,536 KB
testcase_04 AC 118 ms
55,944 KB
testcase_05 AC 117 ms
55,800 KB
testcase_06 WA -
testcase_07 AC 123 ms
55,804 KB
testcase_08 AC 119 ms
56,032 KB
testcase_09 AC 118 ms
55,872 KB
testcase_10 AC 119 ms
55,796 KB
testcase_11 AC 119 ms
54,336 KB
testcase_12 AC 124 ms
56,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.Math.*;
 
public class ppp {
	
	
		
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  long r=sc.nextInt();
	  long c=sc.nextInt();
	  long x=0;
	  if(r==c){
		x=(r*r/4);
		if(r%2==1){
			x+=r/2+r/2+1;
		}
	  }
	  if(r!=c){
		  x=(r/2)*(c/2)*2;
		  if(r%2==0 && c%2==1){
			  x+=r/2;
		  }
		  if(r%2==1 && c%2==0){
			  x+=c/2;
		  }
		  if(r%2==1 && c%2==1){
			  x+=c/2+r/2+1;
		  }
		  
	  }
	  System.out.println(x-1);
	  
  }}
0