結果

問題 No.84 悪の算盤
ユーザー holegumaholeguma
提出日時 2015-08-14 16:08:52
言語 Java19
(openjdk 21)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 1,483 bytes
コンパイル時間 2,393 ms
コンパイル使用メモリ 74,868 KB
実行使用メモリ 49,620 KB
最終ジャッジ日時 2023-08-03 12:12:43
合計ジャッジ時間 3,928 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
49,604 KB
testcase_01 AC 45 ms
49,176 KB
testcase_02 AC 46 ms
49,184 KB
testcase_03 AC 47 ms
49,340 KB
testcase_04 AC 47 ms
49,176 KB
testcase_05 AC 47 ms
49,220 KB
testcase_06 AC 47 ms
49,436 KB
testcase_07 AC 47 ms
49,256 KB
testcase_08 AC 47 ms
49,620 KB
testcase_09 AC 47 ms
49,360 KB
testcase_10 AC 47 ms
49,312 KB
testcase_11 AC 47 ms
49,380 KB
testcase_12 AC 47 ms
49,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.StringTokenizer;


class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
long a=Long.parseLong(st.nextToken());
long b=Long.parseLong(st.nextToken());
long ans;
if(a%2==0||b%2==0){
if(a==b) ans=(a*b/4)-1;
else ans=(a*b/2)-1;
}
else{
if(a==b) ans=(a*b-1)/4;
else ans=(a*b-1)/2;
}
out.println(ans);
out.flush();
}
}

static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}

static class Edge{
int from;
int to;
int cost;
Edge(int from,int to,int cost){
this.from=from; this.to=to; this.cost=cost;
}
Edge(int to,int cost){
this.to=to; this.cost=cost;
}
}

static class Node{
int d;
int v;
Node(int d,int v){
this.d=d; this.v=v;
}
final static Comparator<Node> DISTANCE_ORDER=new DistanceOrderComparator();
static class DistanceOrderComparator implements Comparator<Node>{
public int compare(Node n1,Node n2){
return (n1.d>n2.d)?1:(n1.d<n2.d)?-1:0;
}
}
}
}
0