Submission #928935


Source Code Expand

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.function.BiFunction;

public class Main {
  Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    new Main().run();
  }

  void run() {
    int n = ni();
    int k = ni();
    int sum = k;
    for (int i = 1; i < n; ++i) {
      sum *= k - 1;
    }
    System.out.println(sum);
  }

  int ni() {
    return Integer.parseInt(sc.next());
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }

  class BIT<T> {
    int n;
    ArrayList<T> bit;
    BiFunction<T, T, T> bif;

    BIT(int n, BiFunction<T, T, T> bif, T defaultValue) {
      this.n = n;
      bit = new ArrayList<>(n + 1);
      for (int i = 0; i < n + 1; ++i) {
        bit.add(defaultValue);
      }
      this.bif = bif;
    }

    void update(int i, T v) {
      for (int x = i; x <= n; x += x & -x) {
        bit.set(x, bif.apply(bit.get(x), v));
      }
    }

    T reduce(int i, T defaultValue) {
      T ret = defaultValue;
      for (int x = i; x > 0; x -= x & -x) {
        ret = bif.apply(ret, bit.get(x));
      }
      return ret;
    }
  }

}

Submission Info

Submission Time
Task B - Painting Balls with AtCoDeer
User arukuka
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 1236 Byte
Status AC
Exec Time 123 ms
Memory 9556 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt
Case Name Status Exec Time Memory
0_000.txt AC 120 ms 9552 KB
0_001.txt AC 121 ms 9556 KB
0_002.txt AC 123 ms 9552 KB
1_003.txt AC 123 ms 9548 KB
1_004.txt AC 123 ms 9552 KB
1_005.txt AC 123 ms 9552 KB
1_006.txt AC 123 ms 9552 KB
1_007.txt AC 122 ms 9548 KB
1_008.txt AC 123 ms 9556 KB
1_009.txt AC 123 ms 9548 KB