简单题。

第一次交换$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;
;
void File()
{
    freopen("D:\\in.txt","r",stdin);
    freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
    ;
    while(!isdigit(c)) c=getchar();
    +c-'; c=getchar();}
}

int n,k;

int main()
{
    scanf("%d%d",&n,&k);
    ) k=n/;
    LL ans=; int num=n;
    ;i<=k;i++)
    {
        ans=ans+num-+num-;
        num=num-;
    }
    printf("%lld\n",ans);
    ;
}

CodeForces 645B Mischievous Mess Makers的更多相关文章

  1. Codeforces 645B Mischievous Mess Makers【逆序数】

    题目链接: http://codeforces.com/problemset/problem/645/B 题意: 给定步数和排列,每步可以交换两个数,问最后逆序数最多是多少对? 分析: 看例子就能看出 ...

  2. 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 ...

  3. codeforces 655B B. Mischievous Mess Makers(贪心)

    题目链接: B. Mischievous Mess Makers time limit per test 1 second memory limit per test 256 megabytes in ...

  4. 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 ...

  5. codeforces 655C C. Enduring Exodus(二分)

    题目链接: C. Enduring Exodus time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  6. codeforces645B

    Mischievous Mess Makers CodeForces - 645B It is a balmy spring afternoon, and Farmer John's n cows a ...

  7. 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 ...

  8. Code Forces 645C Enduring Exodus

    C. Enduring Exodus time limit per test2 seconds memory limit per test256 megabytes inputstandard inp ...

  9. CodeForces - 645F:Cowslip Collections (组合数&amp;&amp;欧拉函数)

    In an attempt to make peace with the Mischievious Mess Makers, Bessie and Farmer John are planning t ...

随机推荐

  1. 传播正能量&mdash;&mdash;做一个快乐的程序员

    引子 今天在博客园看到施瓦小辛格的文章我们搞开发的为什么会感觉到累,顿时有感而发.自己本来不擅长写文章,更不擅长写这种非技术性的文章,但是在思绪喷薄之际,还是止不住有很多话要说.针对从客观上说&quo ...

  2. jquery插件-表单验证插件-demo

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. 排序小结(C++版)

    一.快速排序 #include <iostream> using namespace std; int adjust(int a[],int start,int end) { int i, ...

  4. Oracle数据库学习第一天

    crud 增删改查 create read update delete1--oracle数据库的安装 系统默认创建两个用户 sys和system 密码自定义 超级管理员:sys 管理员:system ...

  5. leetcode@ [30/76] Substring with Concatenation of All Words &amp; Minimum Window Substring (Hashtable, Two Pointers)

    https://leetcode.com/problems/substring-with-concatenation-of-all-words/ You are given a string, s, ...

  6. Eclipse Velocity插件安装

    打开eclipse安装velocity插件,这里有两种eclipse velocity的安装 方式一:不推荐的安装(安装会失败) Help>install new software>add ...

  7. FTP 安装配置

    FTP 安装配置: 一.基础操作 yum install -y ftp yum install -y vsftpd service iptables stop chkconfig iptables o ...

  8. 知识扩展--if...else...与switch...case...的执行原理

    一.简述 编程语言中的条件分支结构有两种:if-else和switch-case,这两种条件分支之间可以相互转换,但是也存在一些区别,那么什么时候该用if-else,什么时候该用switch-case ...

  9. sql2008升级到r2提示:检查当前是否正确配置了报表服务器、数据库服务器是否正在运行以及您是否有权访问

    sql2008升级到r2提示:检查当前是否正确配置了报表服务器.数据库服务器是否正在运行以及您是否有权访问 解决方法:把服务开启ok

  10. Linux command stty

    Linux command stty reference: https://blog.csdn.net/lqxandroid2012/article/details/78929506 [Purpose ...