0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ABC - 078- A&B&C

Last updated at Posted at 2019-04-02

AtCoder ABC 078 A&B&C

AtCoder - 078

A問題

  • characterとして比較すれば大小がわかる
	private void solveA() {
		char x = next().charAt(0);
		char y = next().charAt(0);

		out.println(x < y ? "<" : x > y ? ">" : "=");
	}

B問題

  • 出力例1を参考にする
	private void solveB() {
		int numX = nextInt();
		int numY = nextInt();
		int numZ = nextInt();

		int res = (numX - numZ) / (numY + numZ);

		out.println(res);
	}

C問題

【一回のテストにかかる時間:x】
 $X = 1900M + 100(N-M)$

【確率:p】
 $p=1 / 2^m$

【期待値:y】
$y=X + (1-p)(A=かかる時間)$

  • $(1-p)(A=かかる時間)$は、$(1-p)$の確率で追加のテストケースを通すのにかかる時間のこと
  • $X$は初回にかかる時間

$(A=かかる時間)$ は、{$X$}ではなく、{$y$} 

そのため【期待値:y】は、 $y=X + (1-p)y$ となる。

これを解くと、 $y=X/p$ となる。
上記より、$y=(1900M + 100(numN-numM)) * 2^m$ が導ける。

	private void solveC() {
		int numN = nextInt();
		int numM = nextInt();

		long ans = 1900 * numM + 100 * (numN - numM);
		long res = (long) (ans * Math.pow(2, numM));
		out.println(res);
	}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?