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. Protobuf for Python测试保存和读取文件

    安装pip, setuptools, and wheel 如果已经从python.org,安装啦Python 2 >=2.7.9 or Python 3 >=3.4 ,那么就已经有啦pip ...

  2. Windows综合应用

    待修改中-------------------------------------- 快捷键部分: Win+E:打开"我的电脑"E:Explot的缩写,即资源管理器. ------ ...

  3. cURL函数

    PHP的cURL函数是通过libcurl库与服务器使用各种类型的协议进行连接和通信的,curl目前支持HTTP GET .HTTP POST .HTTPS认证.FTP上传.HTTP基于表单的上传.co ...

  4. Test Regular Expressions Online with RegExr免费的正则表达式检验网站

    免费的正则表达式检验网站: http://www.regexr.com

  5. PAT mooc DataStructure 4-2 SetCollection

    数据结构习题集-4-2 集合的运用 1.题目: We have a network of computers and a list of bi-directional connections. Eac ...

  6. Linux的用户及用户组

    一./etc/group下存储当前系统中所有的用户组信息 -Group:   x   : 123  :abc,def,xyz -组名称:组密码占位符:组编号:组中用户名列表 二./etc/gshado ...

  7. 浏览器兼容innerText nextElementSibling firstElementChild

    //下面是封装的方法,可以直接使用 //获dom对象的innerText的取值 function getInnerText(element){ //判断浏览器是否支持innerText if(type ...

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

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

  9. core dump 是什么意思?

    core dump,翻译过来讲,就是核心转储.大致上就是指,如果由于应用错误,如浮点异常.指令异常等,操作系统将会转入内核的异常处理,向对应的进程发送特定的信号(SIGNAL),如果进程中没有对这些信 ...

  10. Velocity简单语法及VelocityHelper封装

    1.简单替换##这是注释Wellcome ${userName}! Now:$date 2.申明变量:#set( $iAmVariable = "good!" )Welcome $ ...