Magic Points ZOJ - 4032
The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple
Magic Points
题意:给你3n个点,编号从0到3n-1,呈正放心分布,找n对点连起来,让线与线的交点经可能多。
题解:最下面的这n个点,前n - 1个点和第n + 1到 2n - 1个点相连,第n个点和第3n - 2个相连。(画图+猜想一下,QWQ)
特判一下n == 2 的情况。
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
int main()
{
int t,n;
scanf("%d", &t);
while(t--)
{
scanf("%d",&n);
if(n == 2) {
printf("0 2 1 3\n");
continue;
}
for(int i = 0; i < n - 1; i ++)
{
printf("%d %d ",i,i + n);
}
printf("%d %d\n", n - 1, 3 * n - 2);
}
return 0;
}
Magic Points ZOJ - 4032的更多相关文章
- ACM-ICPC 2018 青岛赛区现场赛 D. Magic Multiplication && ZOJ 4061 (思维+构造)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4061 题意:定义一个长度为 n 的序列 a1,a2,..,an ...
- Perl 内部结构详解
PerlGuts Illustrated Version 0.49, for perl 5.20 and older This document is meant to supplement the ...
- 2018浙江省赛(ACM) The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple
我是铁牌选手 这次比赛非常得爆炸,可以说体验极差,是这辈子自己最脑残的事情之一. 天时,地利,人和一样没有,而且自己早早地就想好了甩锅的套路. 按理说不开K就不会这么惨了啊,而且自己也是毒,不知道段错 ...
- 2018.03.04 晚上Atcoder比赛
C - March Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement There are N ...
- AtCoder Beginner Contest 089完整题解
A - Grouping 2 Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There a ...
- AtCoder Beginner Contest 089 D - Practical Skill Test
Problem Statement We have a grid with H rows and W columns. The square at the i-th row and the j-th ...
- ZOJ 2477 Magic Cube(魔方)
ZOJ 2477 Magic Cube(魔方) Time Limit: 2 Seconds Memory Limit: 65536 KB This is a very popular gam ...
- ZOJ 3622 Magic Number 打表找规律
A - Magic Number Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Subm ...
- [ZOJ 3622] Magic Number
Magic Number Time Limit: 2 Seconds Memory Limit: 32768 KB A positive number y is called magic n ...
随机推荐
- Codeforces 666E Forensic Examination(广义后缀自动机+线段树合并)
将所有串(包括S)放一块建SAM.对于询问,倍增定位出该子串所在节点,然后要查询的就是该子串在区间内的哪个字符串出现最多.可以线段树合并求出该节点在每个字符串中的出现次数. #include<b ...
- Python 的 Mixin 类(转)
转1:https://www.cnblogs.com/aademeng/articles/7262520.html 转2:https://blog.csdn.net/u010377372/articl ...
- Http 与 Https区别
传统Http协议弊端 传统Http协议弊端是明文的,如果别人采用抓包分析可以获取到明文数据. 什么是Https协议 HTTPS(Hyper Text Transfer Protocol over Se ...
- linux时间同步ntpdate
1.安装ntpdate,执行以下命令 yum install ntpdate -y 2.手工同步网络时间,执行以下命令,将从time.nist.gov同步时间 ntpdate 0.asia.pool. ...
- 怎样用sql语句复制表table1到表table2的同时复制主键
原文:怎样用sql语句复制表table1到表table2的同时复制主键 在从table1表复制到table2的时候,我们会用语句: select * into table2 from table1 但 ...
- 如何解决js地址栏中传递中文乱码的问题
目标要求: 实现从A页面跳转至B页面,B页面接收A页面通过地址栏传递过来的中文参数,中文不能出现乱码. A页面部分代码(传递参数): var title = "这是中文"; var ...
- SMTP命令
SMTP(Simple Mail Transfer Protocol)简单邮件传输协议 Basic Commands: HELO(Hello):标识用户身份 MAIL FROM:发件人地址 RCPT ...
- JS实现数组去重(重复元素保留一个)
1.遍历数组法 它是最简单的数组去重方法(indexOf方法) 实现思路:新建一个数组,遍历去要重的数组,当值不在新数组的时候(indexOf为-1)就加入该新数组中: var arr=[2,8,5, ...
- Vs2017 FrameWork EF Mysql 控制台应用
1 运行环境 vs2017 Net FromWork 4.6.2 手动版 没有 ado.net 实体数据模型 2 NuGet MySql.Data.Entity 6.10.9, MySq ...
- 用Python做一个飞机大战游戏
基于pygame的一款小游戏 这是我上半年做的一款小游戏,但是一直忘记了,现在才上传代码. github项目地址:StarMan 代码基于pygame,Python版本3.5.2运行正常. 游戏很简单 ...