CodeForces 645B Mischievous Mess Makers
简单题。
第一次交换$1$和$n$,第二次交换$2$和$n-1$,第三次交换$3$和$n-2$.....计算一下就可以了。
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c=getchar(); x=;
while(!isdigit(c)) c=getchar();
while(isdigit(c)) {x=x*+c-''; c=getchar();}
} int n,k; int main()
{
scanf("%d%d",&n,&k);
if(k>n/) k=n/;
LL ans=; int num=n;
for(int i=;i<=k;i++)
{
ans=ans+num-+num-;
num=num-;
}
printf("%lld\n",ans);
return ;
}
CodeForces 645B Mischievous Mess Makers的更多相关文章
- Codeforces 645B Mischievous Mess Makers【逆序数】
题目链接: http://codeforces.com/problemset/problem/645/B 题意: 给定步数和排列,每步可以交换两个数,问最后逆序数最多是多少对? 分析: 看例子就能看出 ...
- Code Forces 645B Mischievous Mess Makers
It is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in thei ...
- codeforces 655B B. Mischievous Mess Makers(贪心)
题目链接: B. Mischievous Mess Makers time limit per test 1 second memory limit per test 256 megabytes in ...
- CROC 2016 - Elimination Round (Rated Unofficial Edition) B. Mischievous Mess Makers 贪心
B. Mischievous Mess Makers 题目连接: http://www.codeforces.com/contest/655/problem/B Description It is a ...
- codeforces 655C C. Enduring Exodus(二分)
题目链接: C. Enduring Exodus time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- codeforces645B
Mischievous Mess Makers CodeForces - 645B It is a balmy spring afternoon, and Farmer John's n cows a ...
- CROC 2016 - Elimination Round (Rated Unofficial Edition) C. Enduring Exodus 二分
C. Enduring Exodus 题目连接: http://www.codeforces.com/contest/655/problem/C Description In an attempt t ...
- Code Forces 645C Enduring Exodus
C. Enduring Exodus time limit per test2 seconds memory limit per test256 megabytes inputstandard inp ...
- CodeForces - 645F:Cowslip Collections (组合数&&欧拉函数)
In an attempt to make peace with the Mischievious Mess Makers, Bessie and Farmer John are planning t ...
随机推荐
- SQL Server 远程链接服务器详细配置
原文:SQL Server 远程链接服务器详细配置[转载] http://hi.baidu.com/luxi0194/blog/item/a5c2a9128a705cc6c2fd7803.html - ...
- 附加没有LDF的数据库文件
原文:附加没有LDF的数据库文件 如果你只下载了数据文件,没有LDF文件,那么附加的时候选择使用ATTACH_REBUILD_LOG. 命令类似: USE [master] GO CREATE DAT ...
- sql 将datetime类型转化为指定格式的字符串
), ) -- 输出: 05 16 2006 10:57AM ), ) -- 输出: 05/16/06 ), ) -- 输出: 06.05.16 ), ) -- 输出: 16/05/06 ), ) - ...
- 处理程序“svc-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”
HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法提供您请求的页面.如果该页面是脚本,请添加处理程序.如果应下载文件,请添加 MIME 映射. 解决办法:以管理员运行命令:C: ...
- HP quality center 9.0 邮件设置
[转载]HP quality center 9.0 邮件设置 (2010-09-20 10:28:03) 转载▼ 标签: 转载 原文地址:HP quality center 9.0 邮件设置作者: ...
- 创建自己的github代码库
前提: 1.安装git 2.在github上创建一个repository(库),如名字叫Hello-World,则git地址为https://github.com/username/Hello-Wor ...
- maven 启蒙
Maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具.为了替代ANT的Apache开源项目.现在的项目越来越大.ANT已经不适用了. 1.部署m ...
- Webapi帮助文档
生成自己的Webapi帮助文档(一) 最近Webapi接口的开发刚刚进入尾声,随之而来的是让用户知道接口的详细参数信息,看过淘宝的接口文档,但网上没找到他的实现方式 虽然新建Webapi时C#也会给你 ...
- 2013.7.19 STL库的学习
STL提供了一组表示容器,迭代器,函数对象和算法的模板. 容器是一个与数组类似的单元,可以存储若干个值.容器是同质的,即存储的值的类型一样. 算法是完成特定任务的处方. 迭代器能够用来遍历容器的对象, ...
- jquery水印插件:placeholder
jquery水印插件:placeholder 有的浏览器支持html5的水印placeholder(如Crome,firefox,ie10+),有的不支持html5的placeholder(ie9,i ...