Educational Codeforces Round 16
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);
;
}
题目大意:给你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()/ ]);
;
}
题目大意:给你一个奇数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 +=;
}
}
}
;
}
Educational Codeforces Round 16的更多相关文章
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [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 ...
- [Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...
- 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 ...
- Educational Codeforces Round 16 D. Two Arithmetic Progressions (不互质中国剩余定理)
Two Arithmetic Progressions 题目链接: http://codeforces.com/contest/710/problem/D Description You are gi ...
- Educational Codeforces Round 16 E. Generate a String (DP)
Generate a String 题目链接: http://codeforces.com/contest/710/problem/E Description zscoder wants to gen ...
- Educational Codeforces Round 16 A B C E
做题太久也有点累了..难题不愿做 水题不愿敲..床上一躺一下午..离下一场div2还有点时间 正好有edu的不计分场 就做了一下玩玩了 D是个数学题 F是个AC自动机 都没看明白 留待以后补 A 给出 ...
随机推荐
- js 时间操作和随机数操作
function Data() { var date = new Date(); var year = date.getFullYear(); ; var strDate = date.getDate ...
- 关于WEB项目的一点想法
有点失落.迷茫,差点在上班的时候发了火.原因是之前离职的一位同事,在代码里不加注释,而且百般偷懒,致使很多应该的验证没有验证,很多应该考虑到的情况没有考虑.因为是老员工,我相比他来说是新员工.气势上总 ...
- 《Python核心编程》 18.多线程编程(一)
一进程和线程 1参考链接: http://www.zhihu.com/question/25532384 中OF小工和zhonyong 的回答 总结他们两的回答: 引言: 1.电脑的运行,在硬件上是C ...
- 数据存储_ SQLite(3)
SQLite的应用 一.简单说明 1.在iOS中使用SQLite3,首先要添加库文件 libsqlite3.dylib 2.导入主头文件 #import <sqlite3.h> 二.具体说 ...
- 浏览器内核控制Meta标签说明文档
浏览器内核控制Meta标签说明文档 原文链接 背景介绍 由于众所周知的情况,国内的主流浏览器都是双核浏览器:基于Webkit内核用于常用网站的高速浏览.基于IE的内核用于兼容网银.旧版网站.以360的 ...
- python 3编码
python 3和2很大区别就是python本身改为默认用unicode编码. 字符串不再区分"abc"和u"abc", 字符串"abc"默 ...
- LYDSY热身赛 escape
Description 给出数字N(1<=N<=10000),X(1<=x<=1000),Y(1<=Y<=1000),代表有N个敌人分布一个X行Y列的矩阵上矩形的行 ...
- PHP通用的XSS攻击过滤函数,Discuz系统中 防止XSS漏洞攻击,过滤HTML危险标签属性的PHP函数
XSS攻击在最近很是流行,往往在某段代码里一不小心就会被人放上XSS攻击的代码,看到国外有人写上了函数,咱也偷偷懒,悄悄的贴上来... 原文如下: The goal of this function ...
- 01OC概述
目前来说,Objective-C(简称OC)是iOS开发的核心语言,在开发过程中也会配合着使用C语言.C++,OC主要负责UI界面,C语言.C++可用于图形处理.特点如下: 一.OC基于C语言 C语言 ...
- angularjs 弹出框 $modal 参数(转)
angularjs 弹出框 $modal $modal只有一个方法:open,该方法的属性有: templateUrl:模态窗口的地址 template:用于显示html标签 scope:一个作用 ...