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. ajax之 get post请求

    get请求 function get(){ $.get( "./Aservlet?id=5", function(data, textStatus, jqXHR){ $(" ...

  2. Alpha阶段第六次Scrum Meeting

    情况简述 Alpha阶段第六次Scrum Meeting 敏捷开发起始时间 2016/10/27 00:00 敏捷开发终止时间 2016/10/28 00:00 会议基本内容摘要 提出了目前阶段遇到的 ...

  3. linux 遇见的问题

    Permissions 0644 for '/root/.ssh/id_rsa' are too open.问题 如果出现 Permissions 0644 for '/root/.ssh/id_rs ...

  4. Node实践之二

    先从一个简单的demo说起,用cmd打开命令提示符,输入echo Hello,大家是不是看到终端上显示出了Hello字样,事实上这就是一个简单的事件. 回到正题,相信提到node.js,免不了让人想起 ...

  5. 深入浅出HTTP请求(转自http://www.cnblogs.com/yin-jingyu/archive/2011/08/01/2123548.html)

    HTTP(HyperText Transfer Protocol)是一套计算机通过网络进行通信的规则.计算机专家设计出HTTP,使HTTP客户(如Web浏览器)能够从HTTP服务器(Web服务 器)请 ...

  6. XPath函数——字符串函数(转载)

    本文是转载的,原文网址:http://www.cnblogs.com/zhaozhan/archive/2010/01/17/1650242.html 字符串函数主要用来处理字符串.字符串函数主要包括 ...

  7. Python Day10

    进程 在python中multiprocess模块提供了Process类,实现进程相关的功能.但是,由于它是基于fork机制的,因此不被windows平台支持.想要在windows中运行,必须使用if ...

  8. HTML补充

    补充一: 让DIV 自动居中 width:980px;margin:0 auto; 补充二: 内敛标签: inline #块级标签转换成内联标签. block #变成块级. inline-block ...

  9. tyvj1191 迎春舞会之三人组舞

    背景     HNSDFZ的同学们为了庆祝春节,准备排练一场舞 描述     n个人选出3*m人,排成m组,每组3人.    站的队形——较矮的2个人站两侧,最高的站中间.    从对称学角度来欣赏, ...

  10. mpp文件转换成jpg图片,可以用pdf文件做中转站

    用project软件做了一个表,发现不能转换成图片,先把mpp文件转换成pdf文件,然后用PS打开pdf文件,存储为jpg格式就行了