[ZJOI2009]函数
恶心啊,居然找规律。
/** * 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; }
作者:HSUPPR
出处:http://www.cnblogs.com/hsuppr/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出
原文链接,否则保留追究法律责任的权利。