matsueushi

AtCoder ABC 255 C - ±1 Operation 1

競プロ    AtCoder
2022-6-12 21:11

https://atcoder.jp/contests/abc255/tasks/abc255_c

\(\min_{i=0,\ldots,n-1}|A+Di-X|\) を求めれば良い。\(y=A+Dx\) と \(y=X\) の交点を求め、 \(x < 0, 1 \le x \le n-1 ,x > n-1\) の場合に応じて計算すれば良い。

\(|A+Di-X|\) が最も小さくなるのは、\(x\) に最も近い \(0\le i \le n-1\) を選んだ時である。

https://atcoder.jp/contests/abc255/submissions/32387318

  • Home
  • Blog
  • BOaT
  • NATSUMEN
  • Playlist
  • Other
  • AtCoder
  • Categories
  • Tags
  • Search
  • About
Copyright © 2019–2025
Built with Hugo and theme Tokiwa. 91 words in this page.

AtCoder ABC 255 D - ±1 Operation 2 AtCoder AGC 023 A - Zero-Sum Ranges
Related AtCoder ABC 255 D - ±1 Operation 2  /  AtCoder ABC 255 E - Lucky Numbers  /  AtCoder diverta 2019 Programming Contest D - DivRem Number  /  AtCoder APC 001 B - Two Arrays  /  AtCoder ABC 198 D - Send More Money  /  AtCoder ABC 129 D - Lamp  /  AtCoder ABC 153 E - Crested Ibis vs Monster  /  AtCoder ABC 161 D - Lunlun Number  /  AtCoder CODE FESTIVAL 2017 qualC C - Inserting 'x'  /  AtCoder ABC 034 A - Kenken Race  /  AtCoder AGC 011 B - Colorful Creatures  /  AtCoder ABC 134 D - Preparing Boxes  /  AtCoder ABC 064 D - Insertion  /  AtCoder ABC 133 D - Rain Flows into Dams  /  AtCoder ABC 094 C - Many Medians

comments powered by Disqus