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 给出 ...
随机推荐
- linux重定向
常用FD有3个,为0(stdin,标准输入).1(stdout,标准输出).2(stderr,标准错误输出),默认与keyboard.monitor有关: cmd > file 把 stdout ...
- Codeforces 2016 ACM Amman Collegiate Programming Contest A. Coins(动态规划/01背包变形)
传送门 Description Hasan and Bahosain want to buy a new video game, they want to share the expenses. Ha ...
- [Unity] 在协程中等待指定的毫秒
先写一个静态类: /// <summary> /// 公用基础函数库 /// <remarks>作者: YangYxd</remarks> /// </sum ...
- 在Application中集成Microsoft Translator服务之优化
在一篇文章中我们已经实现了功能,但是一个明显的问题是响应时间非常长,用户体验非常糟糕,这篇文章将带你找出问题所在并进行优化 为了找出追魁祸首,这里使用 System.Diagnostics.Stopw ...
- 如何处理 在html中 li 的高度自适应(且li里面的内容有浮动的情况下)
废话不多说,我们写贴出代码 这个是 Html 代码 <div class="main"> <ul> <li> <div class=&qu ...
- 关于学习JavaScript 的 高三编程 一些心得(二)
今天在看高三的过程中,解决了之前我在 面试过程中遇到的一个问题. 就是将一段英文 颠倒过来. 下面就是我的代码: var zhang = "my name is zhangge !" ...
- loopback文档翻译
最近在学习loopback,期间在strongloop的官网翻译了部分文章. 见:https://docs.strongloop.com/pages/viewpage.action?pageId=60 ...
- R入门<三>-R语言实战第4章基本数据管理摘要
入门书籍:R语言实战 进度:1-4章 摘要: 1)实用的包 forecast:用于做时间序列预测的,有auto.arima函数 RODBC:可以用来读取excel文件.但据说R对csv格式适应更加良好 ...
- Solr5.4.0部署到Tomcat
所用工具 下载 solr 5.4.0 版本:http://www.apache.org/dyn/closer.lua/lucene/solr/5.4.0 下载 Tomcat(6以上版本),另外可以根据 ...
- 【荐】怎么用PHP发送HTTP请求(POST请求、GET请求)?
file_get_contents版本: <?php /** * 发送post请求 * @param string $url 请求地址 * @param array $post_data pos ...