简体中文
Telegram

讨论串 消息 #2411

5 条消息 · –
  1. K
    import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), d = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } sc.close(); int count = 0; while (true) { int max = 0, min = 0, diff; for (int i = 0; i < n; i++) { if (a[i] > a[max]) { max = i; } if (a[i] < a[min]) { min = i; } } if (a[max]-a[min] <= d) { break; } while ((diff = a[max]-a[min]) > d) { a[max] -= Math.min((diff-d)/2, k); a[min] += Math.min((diff-d)/2, k); count++; } } System.out.println(count); } }

来自搜索索引的公开信息流 ChatCrawler ——“公开 Telegram 的 Google”;随着该社群被抓取而更新。 时间为 UTC。

仅限公开内容,使用 Telegram 官方 API。 关于 · 常见问题 · 索引限制 · 移除页面 · 目录 · 搜索 · 计算方法