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 ...
随机推荐
- bootstrap-paginator 分页插件笔记
[MVC]bootstrap-paginator 分页插件笔记 bootstrap-paginator基于bootstrap框架,使用起来非常简单.官网:http://harttle.github ...
- 【MS SQL】把多个数据库合并为一个新的数据库
原文:[MS SQL]把多个数据库合并为一个新的数据库 因应工作要求,需要把两个数据库合并成一个库: 一开始使用"导入数据.导出数据和复制数据库"三个工具时,没有达到要的效果. 后 ...
- 读书笔记—CLR via C#章节8-10
前言 这本书这几年零零散散读过两三遍了,作为经典书籍,应该重复读反复读,既然我现在开始写博了,我也准备把以前觉得经典的好书重读细读一遍,并且将笔记整理到博客中,好记性不如烂笔头,同时也在写的过程中也可 ...
- 【转】 教你如何创建类似QQ的android弹出菜单
原文地址:http://www.apkbus.com/android-18034-1-1.html 大家可能看到android的自带的系统菜单比较难看,如图: 2011-12-4 23:13 上传 下 ...
- SZU:A66 Plastic Digits
Description There is a company that makes plastic digits which are primarily put on the front door o ...
- 设置控件Enable=false,控件颜色不变
[System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int SetWind ...
- POJ 2337 输出欧拉路径
太无语了. 这道题做了一整天. 主要还是我太弱了. 以后这个就当输出欧拉路径的模版吧. 题目中的输出字典序最小我有点搞不清楚,看了别人是这么写的.但是我发现我过不了后面DISCUSS里面的数据. 题意 ...
- asp.net mvc异步查询
对于asp.net mvc异步查询 如何做MVC异步查询,做列表页面. 查询是项目中必不可少的工作,而且不同的项目不同的团队,都有自己的简单方法.Asp.net mvc 有自己独特的优势,下面是结合m ...
- Play 起步
*****************jdk下载地址: http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.ta ...
- json时间格式的互换
c#代码 public class DateTimeUtil { /// <summary> /// 把json的时间格式还原-服务端 /// </summary> /// & ...