恶心啊,居然找规律。

/**
 * Problem:function
 * Author:Shun Yao
 * Time:2103.5.31
 * Result:Accepted
 */

#include <cstdio>

long min(long x, long y) {
	return x < y ? x : y;
}

int main() {
	long n, k;
	freopen("function.in", "r", stdin);
	freopen("function.out", "w", stdout);
	scanf("%ld%ld", &n, &k);
	if (n == 1)
		putchar('1');
	else
		printf("%ld", min(k, (n - k + 1)) << 1);
	fclose(stdin);
	fclose(stdout);
	return 0;
}

 

相关文章:

  • 2021-05-30
  • 2021-10-15
  • 2022-01-29
  • 2021-07-14
  • 2022-02-09
  • 2021-11-18
猜你喜欢
  • 2021-09-17
  • 2022-01-13
  • 2021-11-22
  • 2021-05-24
  • 2021-11-06
  • 2021-10-01
  • 2022-02-23
相关资源
相似解决方案