zoukankan      html  css  js  c++  java
  • CF 1368C Even Picture

    传送门

    题目:

    ①所有块之间能够相互到达,即使一个连通图

    ②所有块有偶数个邻居

    ③规定有n个块有4个邻居

    每组测试给定一个n,问你怎么构造一个图。

    思路:水题。我们先构造好一个边长为2的矩形,然后我们给该矩形右下角添加三个块就能表达一个“有四个邻居”的块。

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <algorithm>
     4 #include <queue>
     5 #include <string>
     6 #include <vector>
     7 #include <cmath>
     8 #include <stack>
     9 #include <map>
    10  
    11 using namespace std;
    12   
    13 #define ll long long
    14 #define pb push_back
    15 #define fi first
    16 #define se second
    17   
    18 const int N = 2e6 + 10;
    19 
    20 
    21 void solve()
    22 {
    23     int n;
    24     cin >> n;
    25     int sum = 7 + (n - 1) * 3;
    26     printf("%d
    ", sum);
    27     printf("%d %d
    %d %d
    ",0,0,1,0);
    28     printf("%d %d
    %d %d
    ",0,1,1,1);
    29     int x = 2, y = 2;
    30     for(int i = 1; i <= n; ++i){
    31         printf("%d %d
    %d %d
    %d %d
    ",x,y,x-1,y,x,y-1);
    32         x += 1; y += 1;
    33     }
    34 }
    35   
    36 int main()
    37 {
    38     // ios::sync_with_stdio(false);
    39     // cin.tie(0);
    40     // cout.tie(0);
    41 
    42     solve();
    43  
    44     return 0;
    45 }
  • 相关阅读:
    (转)[数据库基础]——编码标准之命名
    学习进度-06
    学习进度-05
    学习进度-04 Scala的学习
    学习进度-03
    学习进度-02
    学习进度-01
    《用例分析技术》读后感-01
    《掌握需求过程》阅读笔记-02
    《掌握需求过程》读后感-01
  • 原文地址:https://www.cnblogs.com/SSummerZzz/p/13394582.html
Copyright © 2011-2022 走看看