結果

問題 No.84 悪の算盤
ユーザー リチウムリチウム
提出日時 2014-12-03 00:19:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 544 bytes
コンパイル時間 3,142 ms
コンパイル使用メモリ 72,012 KB
実行使用メモリ 56,208 KB
最終ジャッジ日時 2023-08-03 12:01:16
合計ジャッジ時間 5,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,816 KB
testcase_01 AC 125 ms
56,028 KB
testcase_02 AC 125 ms
55,852 KB
testcase_03 AC 123 ms
55,916 KB
testcase_04 AC 124 ms
55,484 KB
testcase_05 AC 124 ms
54,116 KB
testcase_06 AC 126 ms
55,712 KB
testcase_07 AC 126 ms
55,484 KB
testcase_08 AC 124 ms
56,208 KB
testcase_09 AC 123 ms
56,112 KB
testcase_10 AC 124 ms
56,012 KB
testcase_11 AC 124 ms
55,932 KB
testcase_12 AC 123 ms
55,916 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/2)*(r/2);
		if(r%2==1){
			x+=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