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. Linux 内核数据结构:Linux 双向链表

    Linux 内核提供一套双向链表的实现,你可以在 include/linux/list.h 中找到.我们以双向链表着手开始介绍 Linux 内核中的数据结构 ,因为这个是在 Linux 内核中使用最为 ...

  2. BZOJ1017: [JSOI2008]魔兽地图DotR

    传送门 设$f[i][j][k]$表示对于第$i$个点,向父节点贡献$j$个已合成的装备,花费了$k$的代价,最多获得的力量值. 单纯的$f[i][j][k]$是很难转移的,主要原因是无法维护和其他儿 ...

  3. Liunx下查看服务器硬件信息

    一.如何查看服务器的CPU 今天安装了9台Linux服务器,型号完全不一样(有DELL. HP和IBM服务器),又懒得去对清单,如何在Linux下cpu的个数和核数呢?另外,nginx的cpu工作模式 ...

  4. 要学Java,怎么高效地学习,怎么规划

    要学Java,怎么高效地学习,怎么规划?   题主是一个个例,99%的人(包括我自己)都没有题主这样的经历,也很难提出具有很强参考性的java学习建议.我倒是之前面试过一个跟题主有点类似的人,拿出来分 ...

  5. sde用户下使用sqlplus登录错误ORA-12547: TNS:lost contact

    环境:linux + oracle +arcsde   解决:root用户下增加$ORACLE_HOME/bin/oracle文件的s权限 [oracle@localhost bin]$ chmod ...

  6. js 常用函数收集(基础)

    (1).判断是否为数值 function isNum(obj){ return !isNaN(parseFloat(obj)) && isFinite(obj); } (2).判断是否 ...

  7. CSS line-height与vertical-align:baseline

    一.当line-height与vertical-align相遇,会发生很多匪夷所思的现象 首先,请看如下代码: <!DOCTYPE html> <html> <head& ...

  8. 多线程之GCD

    什么是GCD Grand Central Dispatch 是Apple开发的一种多核编程技术.主要用于优化应用程序以支持多核处理器以及其他多对称处理系统TA会自动管理线程的生命周期(创建线程.调度任 ...

  9. MEF 根据配置注入Service

    有这样的场景 : 现在一个接口有很多种实现类,需要根据配置,来确定确定调用哪个具体的实现类.这样使得软件扩展性大大提高 在MEF可以通过ExportMetadata 来实现这样的效果. 1.现在我们建 ...

  10. 转】C#接口-显式接口和隐式接口的实现

    [转]C#接口-显式接口和隐式接口的实现 C#中对于接口的实现方式有隐式接口和显式接口两种: 类和接口都能调用到,事实上这就是“隐式接口实现”. 那么“显示接口实现”是神马模样呢? interface ...