The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

Magic Points

ZOJ - 4032

题意:给你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的更多相关文章

  1. ACM-ICPC 2018 青岛赛区现场赛 D. Magic Multiplication && ZOJ 4061 (思维+构造)

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4061 题意:定义一个长度为 n 的序列 a1,a2,..,an ...

  2. Perl 内部结构详解

    PerlGuts Illustrated Version 0.49, for perl 5.20 and older This document is meant to supplement the  ...

  3. 2018浙江省赛(ACM) The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple

    我是铁牌选手 这次比赛非常得爆炸,可以说体验极差,是这辈子自己最脑残的事情之一. 天时,地利,人和一样没有,而且自己早早地就想好了甩锅的套路. 按理说不开K就不会这么惨了啊,而且自己也是毒,不知道段错 ...

  4. 2018.03.04 晚上Atcoder比赛

    C - March Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement There are N  ...

  5. AtCoder Beginner Contest 089完整题解

    A - Grouping 2 Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There a ...

  6. 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 ...

  7. ZOJ 2477 Magic Cube(魔方)

    ZOJ 2477 Magic Cube(魔方) Time Limit: 2 Seconds      Memory Limit: 65536 KB This is a very popular gam ...

  8. ZOJ 3622 Magic Number 打表找规律

    A - Magic Number Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Subm ...

  9. [ZOJ 3622] Magic Number

    Magic Number Time Limit: 2 Seconds      Memory Limit: 32768 KB A positive number y is called magic n ...

随机推荐

  1. 解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 以及MyBatis批量加载xml映射文件的方式

    错误 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 的出现,意味着项目需要xml文件来 ...

  2. (十)Activitivi5之启动流程/完成任务的时候设置流程变量

    一.启动流程的时候设置流程变量 1.1 案例 /** * 启动流程实例 */ @Test public void start() { Student student=new Student(); st ...

  3. 查找-------(HashCode)哈希表的原理

    这段时间 在 准备软件设计师考试    目的是想复习一下  自己以前没怎么学的知识    在这个过程中  有了很大的收获  对以前不太懂得东西  在复习的过程中  有了很大程度的提高 比如在复习 程序 ...

  4. opencv-04--图像金字塔

    图像金字塔被广泛应用于各种视觉应用中.图像金字塔是一个图像集合,集合中图像都源于同一个原始图像,而且是通过对原始图像连续降采样获得,直到达到某个中止条件才停止降采样.(当然,降为一个像素肯定是中止条件 ...

  5. ASP.NET WEB应用程序(.network4.5)MVC 程序的结构解读1

    https://www.cnblogs.com/-beauTiFul/p/8036509.html 简介 开发环境:VS2015 ASP.NET:可以开发出几乎所有运行在Windows上的应用程序:. ...

  6. Express无法解析POST请求的JSON参数

    在用Express和MongoDB搭建后端开发环境时,可能会利用测试工具发送带有JSON格式数据的POST请求,那么这时就要利用request.body获取json数据,但此时可能遇到json无法解析 ...

  7. 封装jquery的ajax

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. # marshalsec使用

    开启rmi服务,恶意类放到服务上 D:\jdk_1.8\bin\java.exe -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRe ...

  9. linux文件系统初学

    Linux磁盘分区和目录 Linux发行版之间的差别很小,差别主要表现在系统管理的特色工具以及软件包管理方式的不同. Windows的文件结构是多个并列的树状结构,最顶部是不同的磁盘(分区),如C,D ...

  10. git——日常保险操作

    git fetch --all //拉取远程最新代码 git reset --hard origin/master //如果本地无法更新,使用远程覆盖本地 git branch old_master ...