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. Bitbucket入门手册

    老大要我去调研一下有什么好用的免费软件版本管理工具,有利于小团队开发的.我第一个想到的就是git,经常在git下东西,听说它的代码仓库好用,于是就注册了一个github的账号,创建仓库的时候才发现只能 ...

  2. PAT-1014 Waiting in Line (30 分) 优先队列

    Suppose a bank has N windows open for service. There is a yellow line in front of the windows which ...

  3. hdu 6208 上一个kmp模板

    #include <cstdio> #include <cstring> #include <iostream> #include <queue> #i ...

  4. (二十六)JavaBean

    一.定义 1 JavaBean是一个遵循特定写法的Java类,它通常具有如下特点: 这个Java类必须具有一个无参的构造函数 属性必须私有化. 私有化的属性必须通过public类型的方法暴露给其它程序 ...

  5. (十三)Hibernate中的多表操作(3):单向多对多

    多对多的处理方式是,有一张中间表,中间表保存两个多方之间的关系.首先来看实际应用场景:在之前开发的系统中,应用了基于角色的控制访问,也就是RBAC模型,一个用户可能存在多种角色,一种角色也可能有多个用 ...

  6. (二) JPA基础

    一.什么是JAP JPA(Java Persistence API)是SUN官方推出的Java持久化规范,它为Java开发人员提供了一种对象/关联映射工具来管理Java应用中的关系数据.它的出现主要是 ...

  7. 取代Ajax.BeginForm的ajax使用方法

    原文:取代Ajax.BeginForm的ajax使用方法 一.前提概要 Asp.net core中已经取消了Ajax.BeginForm,也不会计划出ajax tag helper,所以得利用插件jq ...

  8. Abp 领域事件简单实践 <二>

    上一篇说的是仓储增删改 的时候会自动触发领域事件. 其实也可以随时触发. 现在在应用层触发. 应用层依赖注入 EventBus public void Trigger() { var e = new ...

  9. Trie-Tree

    最近写了一些关于字典树的题目,这里做个简单的整理. 字典树,又叫单词查找树,顾名思义就是查单词的(不仅仅o),和词典一样.不同的是词典是用纸做的,而字典树是用树形结构构建的. 她用来快速检索你要的内容 ...

  10. C++ ifstream ofstream 注意事项

    很久没写C++,已经完全不会写了... 在使用ifstream读取一个二进制文件时,发现读取的内容和源文件不相同,导致数据解析失败,于是尝试把用ifstream读取的内容用ofstream写入另一个文 ...