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. BOM与DOM的区别与联系

    一.BOM与DOM的区别 1.BOM(Browser Object Model) BOM 即浏览器对象模型,BOM没有相关标准,BOM的最核心对象是window对象.window对象既为javascr ...

  2. (十四)SpringBoot之事务处理

    一.简介 ssh ssm都有事务管理service层通过applicationContext.xml配置,所有service方法都加上事务操作: 用来保证一致性,即service方法里的多个dao操作 ...

  3. 一、eureka服务端自动配置

    所有文章 https://www.cnblogs.com/lay2017/p/11908715.html 正文 @EnableEurekaServer开关 eureka是一个c/s架构的服务治理框架, ...

  4. JS基础 sessionStorage

    html5中的Web Storage包括了两种存储方式:sessionStorage和localStorage. sessionStorage用于本地存储一个会话(session)中的数据,这些数据只 ...

  5. 学习CSRF漏洞并挖掘CSRF漏洞

    什么是跨站请求伪造? 跨站请求伪造(英语:Cross-siterequest forgery),也被称为one-clickattack或者session riding,通常缩写为CSRF或者XSRF, ...

  6. http上传txt文件

    http通过post方式上传txt文件 可以参考 https://www.cnblogs.com/s0611163/p/4071210.html /// <summary> /// Htt ...

  7. Echarts如何添加鼠标点击事件?防止重复触发点击事件

    Echarts如何添加鼠标点击事件? 1.通常我们只使用了以下代码,通过配置项和数据显示图表. var myChart = echarts.init(document.getElementById(' ...

  8. jeffy-vim-v2.9

    http://pan.baidu.com/s/1qW1DlP6

  9. scrapy爬虫框架配置--settings

    我们可以用一个settings.py做个简单的介绍和解析:例: ----> # -*- coding: utf-8 -*- # Scrapy settings for xigua project ...

  10. 全排列 递归方法(permutation原理

    https://blog.csdn.net/axiqia/article/details/50967863  原博客 (一)递归的全排列算法 (A.B.C.D)的全排列为 1.A后面跟(B.C.D)的 ...