A. King Moves

water。= =。

 #include <cstdio>
 ,,,,,-,-,-};
 ,-,,,-,,,-,};
 #define judge(x,y) x >= 1 && x <= 8 && y >= 1 && y <= 8
 int main()
 {
     char t;
     ;
     scanf("%c%d", &t, &y);
     x = t - ;
     ; i < ; i++)
     {
         int fx = x + dx[i], fy = y + dy[i];
         if(judge(fx,fy))    cnt++;
     }
     printf("%d\n", cnt);
     ;
 }

B. Optimal Point on a Line

题目大意:给你n个坐标,找一个点到n个点的距离之和最小,如果有多解,选最左的。

这个感觉就是一道初中数竞题嘛。。那时候好像是一个区间?求的是。

#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
 * 1e5 + ;
int x[maxn];
int main()
{
    int n;
    scanf("%d", &n);
    ; i < n; i++)
        scanf("%d", &x[i]);
    sort(x, x + n);
    printf()/ ]);
    ;
}

C. Magic Odd Square(基础构造)

题目大意:给你一个奇数n,然后输出一个幻方什么的?

昂。幻方的解法,组合数学的书里有,翻来覆去就解出来了,很酷。

然后这题好像是个找规律。。你就会发现有块区域放奇数,有一块放偶数就行了。。

#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
 * 1e5 + ;
int x[maxn];
int main()
{
    , even = ;
    scanf("%d", &n);
    ) / ;
    ; i <= n; i++)
    {
        ; j <= n; j++)
        {
            )
            {
                printf("%d%c", odd, j == n ? '\n' : ' ');
                odd +=;
            }
            else
            {
                printf("%d%c", even, j == n ? '\n' : ' ');
                even +=;
            }
        }
    }
    ;
}

D

E

F

Educational Codeforces Round 16的更多相关文章

  1. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  2. [Educational Codeforces Round 16]D. Two Arithmetic Progressions

    [Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...

  3. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  4. [Educational Codeforces Round 16]B. Optimal Point on a Line

    [Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...

  5. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  6. Educational Codeforces Round 16 E. Generate a String dp

    题目链接: http://codeforces.com/problemset/problem/710/E E. Generate a String time limit per test 2 seco ...

  7. Educational Codeforces Round 16 D. Two Arithmetic Progressions (不互质中国剩余定理)

    Two Arithmetic Progressions 题目链接: http://codeforces.com/contest/710/problem/D Description You are gi ...

  8. Educational Codeforces Round 16 E. Generate a String (DP)

    Generate a String 题目链接: http://codeforces.com/contest/710/problem/E Description zscoder wants to gen ...

  9. Educational Codeforces Round 16 A B C E

    做题太久也有点累了..难题不愿做 水题不愿敲..床上一躺一下午..离下一场div2还有点时间 正好有edu的不计分场 就做了一下玩玩了 D是个数学题 F是个AC自动机 都没看明白 留待以后补 A 给出 ...

随机推荐

  1. 解决Spring MVC @ResponseBody返回中文字符串乱码问题

    spring mvc使用的默认处理字符串编码为ISO-8859-1 解决方法: 第一种方法: 对于需要返回字符串的方法添加注解,如下: @RequestMapping(value="/use ...

  2. XML 架构 (XSD) 参考

    https://msdn.microsoft.com/zh-cn/library/ms256235.aspx XML 架构示例 XML 架构元素 XML 数据类型引用 XML 架构正则表达式 XML ...

  3. CSS书写顺序

    CSS书写顺序 1.位置属性(position, top, right, z-index, display, float等)2.大小(width, height, margin, padding)3. ...

  4. 图解JVM字节码执行引擎之栈帧结构

    一.执行引擎      “虚拟机”的概念是相对于“物理机”而言的,这两种“机器”都有执行代码的能力.物理机的执行引擎是直接建立在硬件处理器.物理寄存器.指令集和操作系统层面的:而“虚拟机”的执行引擎是 ...

  5. Python SMTP邮件模块

    SMTP是发送邮件的协议,Python内置对SMTP的支持,可以发送纯文本邮件.HTML邮件以及带附件的邮件. Python对SMTP支持有smtplib和email两个模块,email负责构造邮件, ...

  6. javascript数据结构与算法--基本排序算法分析

    javascript中的基本排序算法 对计算机中存储的数据执行的两种最常见操作是排序和检索,排序和检索算法对于前端开发尤其重要,对此我会对这两种算法做深入的研究,而不会和书上一样只是会贴代码而已,下面 ...

  7. Solr5.4.0部署到Tomcat

    所用工具 下载 solr 5.4.0 版本:http://www.apache.org/dyn/closer.lua/lucene/solr/5.4.0 下载 Tomcat(6以上版本),另外可以根据 ...

  8. saltstack(master迁移)

    环境:http://www.cnblogs.com/zzzhfo/p/6126223.html 在添加一台master 把master的/etc/salt目录下的pki打包 上传至第二台master的 ...

  9. 2.4使用属性在 ASP.NET Web API 2 路由创建一个 REST API

    Web API 2 支持一种新型的路由,称为属性路由.属性路由的一般概述,请参阅属性路由 Web API 2 中.在本教程中,您将使用属性路由创建一个 REST API 集合的书.API 将支持以下操 ...

  10. FZU 2112 并查集、欧拉通路

    原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...