http://codeforces.com/contest/1072/problem/A

题目挺简单,就是让你求几个环,占得方格的个数,然而题目为什么给出了公式呢?

然而给出的公式辣么丑,还是不用的好。

我们看一个$n \times m$的环型,它的占得方个数为$(n+m) \times 2 -4 $

每次换的大小长宽各减4,那么我们计算就好了。

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int n,m,k,ans;
int main()
{
scanf("%d%d%d",&n,&m,&k);
for(int i=;i<=k;i++)
{
ans+=(n+m)*;
n-=;
m-=;
}
ans-=k*;
printf("%d",ans);
}

Codeforces 517 #A的更多相关文章

  1. Codeforces 517 #B

    http://codeforces.com/contest/1072/problem/B 开始想的只有搜索,时间复杂度$O(4^n)$,明显有问题. 想了半个小时没有思路,然后想到了正难则反,就开始步 ...

  2. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)

    Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) #include <bits/stdc++ ...

  3. Codeforces Round #517 体验记

    原文链接 https://www.cnblogs.com/zhouzhendong/p/CF1071.html 赛前: 呀,这个 Round # 必须打啊. 于是临时改变注意决定打这一场.用小号打. ...

  4. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path

    http://codeforces.com/contest/1072/problem/D bfs 走1步的最佳状态 -> 走2步的最佳状态 -> …… #include <bits/ ...

  5. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path(字典序)

    https://codeforces.com/contest/1072/problem/D 题意 给你一个n*n充满小写字母的矩阵,你可以更改任意k个格子的字符,然后输出字典序最小的从[1,1]到[n ...

  6. Codeforces Round #517 (Div. 2) C. Cram Time(思维+贪心)

    https://codeforces.com/contest/1065 题意 给你a,b,让你找尽量多的自然数,使得他们的和<=a,<=b,用在a和b的自然数不能重复 思路 假如只有一个数 ...

  7. Codeforces Round #517 (Div. 2)(1~n的分配)

    题:https://codeforces.com/contest/1072/problem/C 思路:首先找到最大的x,使得x*(x+1)/2 <= a+b 那么一定存在一种分割使得 a1 &l ...

  8. Codeforces Round #517 Div. 2/Div. 1

    \(n\)天没更博了,因为被膜你赛的毒瘤题虐哭了... 既然打了这次CF还是纪念一下. 看看NOIP之前,接下来几场的时间都不好.这应该是最后一场CF了,差\(4\)分上紫也是一个遗憾吧. A 给一个 ...

  9. Codeforces Round #517 (Div. 2)

    A #include<queue> #include<cstdio> #include<cstring> #include<algorithm> #de ...

随机推荐

  1. map练习小例题

    "fdgavcbsacdfs" 获取该字符串中,每一个字母出现的次数. 要求打印结果是:a(2)b(1)...; 思路: 对于结果的分析发现,字母和次数之间存在着映射关系.而且这种 ...

  2. 如何使用localStorage?

    首先使用localStorage的时候,我们需要判断浏览器是否支持localStorage这个属性. if(!window.localStorage){ alert("浏览器支持locals ...

  3. jQuery背景插件backstretch使用指南

    http://www.bkjia.com/Javascript/987917.html

  4. 练习三十二:用python实现:按相反的顺序输出列表的每一位值

    用python实现:按相反的顺序输出列表的每一位值 1. 使用list[::-1] list1 = ["one","two","three" ...

  5. centOS6.5 关闭关盖待机

    因为centOS安装在笔记本上面的,有时要把电脑放在一边,用SSH连接 所以需要关盖不休眠 用命令没找到怎么设置 后面在桌面电脑选项里面设置的,设置成黑屏或者不执行动作应该都是可以的.

  6. Tensorflow版Faster RCNN源码解析(TFFRCNN) (3)推断(测试)过程使用RPN时代码运行流程

    本blog为github上CharlesShang/TFFRCNN版源码解析系列代码笔记第三篇   推断(测试)过程不使用RPN时代码运行流程 作者:Jiang Wu  原文见:https://hom ...

  7. B. Game of the Rows

    B. Game of the Rows time limit per test 1 second memory limit per test 256 megabytes input standard ...

  8. PHP判断两个矩形是否相交

    <?php $s = is_rect_intersect(1,2,1,2,4,5,0,3); var_dump($s); /* 如果两个矩形相交,那么矩形A B的中心点和矩形的边长是有一定关系的 ...

  9. Swing---WindowConstants

    Java桌面开发过程中,很多人都写过类似下面的代码. import javax.swing.JFrame; public class SimpleFrame { public static void ...

  10. Android(java)学习笔记124:利用Service在后台播放背景音乐

    1. 在android应用程序里,有一种没有UI的类(android.app.Service)——Service.简单来说,Service是一个 background process(背景程序),通过 ...