首页 > 其他分享 >Snowflake Snow Snowflakes[PKUOJ 3349]

Snowflake Snow Snowflakes[PKUOJ 3349]

时间:2023-11-27 17:44:36浏览次数:38  
标签:3349 snowflakes arms snowflake will program each Snowflake Snowflakes

这是一道蓝书上的哈希例题。相对简单。

题面

Description

You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of snowflakes, and search for a pair that may be identical. Each snowflake has six arms. For each snowflake, your program will be provided with a measurement of the length of each of the six arms. Any pair of snowflakes which have the same lengths of corresponding arms should be flagged by your program as possibly identical.

Input

The first line of input will contain a single integer n, 0 < n ≤ 100000, the number of snowflakes to follow. This will be followed by n lines, each describing a snowflake. Each snowflake will be described by a line containing six integers (each integer is at least 0 and less than 10000000), the lengths of the arms of the snow ake. The lengths of the arms will be given in order around the snowflake (either clockwise or counterclockwise), but they may begin with any of the six arms. For example, the same snowflake could be described as 1 2 3 4 5 6 or 4 3 2 1 6 5.

Output

If all of the snowflakes are distinct, your program should print the message:
No two snowflakes are alike.
If there is a pair of possibly identical snow akes, your program should print the message:
Twin snowflakes found.

Sample Input

2
1 2 3 4 5 6
4 3 2 1 6 5

Sample Output

Twin snowflakes found.

Source

CCC 2007

解题思路

 

标签:3349,snowflakes,arms,snowflake,will,program,each,Snowflake,Snowflakes
From: https://www.cnblogs.com/Uninstalllingyi/p/17859945.html

相关文章

  • 雪花算法SnowFlake
    SnowFlake算法结构如下:大致分为了无效位、时间位、机器位和序列号位。1.第一位:占用1bit,其值始终是0,没有实际作用(因为二进制中最高位是符号位,1表示负数,0表示正数。生成的id一般都是用整数,所以最高位固定为0)。2.时间戳:占用41bit,精确到毫秒,总共可以容纳约69年的时间。3.工作机器id:占......
  • UUID和雪花(Snowflake)算法该如何选择?
    UUID和Snowflake都可以生成唯一标识,在分布式系统中可以说是必备利器,那么我们该如何对不同的场景进行不同算法的选择呢,UUID简单无序十分适合生成requestID,Snowflake里面包含时间序列等,可以用于排序,效率都还可以,本文详细介绍了我们选择的使用不同算法的原因,两种算法不同维度的......
  • Code-C++-Snowflake
    Code-C++-Snowflake#include<iostream>#include<chrono>#include<stdexcept>classSnowflake{private://雪花算法的各个参数staticconstexprint64_tworkerIdBits=5;staticconstexprint64_tdatacenterIdBits=5;staticcons......
  • 提高 Snowflake 工作效率的 6 大工具
    推荐:使用NSDT场景编辑器助你快速搭建可二次编辑的3D应用场景Snowflake彻底改变了企业存储、处理和分析数据的方式,提供了无与伦比的灵活性、可扩展性和性能。但是,与任何强大的技术一样,要真正利用其潜力,必须拥有合适的工具供您使用。本文是您在使用Snowflake时可以提高工作效率......
  • Unique Snowflakes uva11572
    找最长的,没有相同元素的区间 双指针#include<iostream>#include<set>usingnamespacestd;constintN=1e6+2;intn,a[N];voidsolve(){ intx=1,y=1,ans=0; set<int>st; while(y<=n){ while(y<=n&&!st.count(a[y]))s......
  • 【go】snowflake和snoyflake雪花算法学习与go实现
    预备知识:MonotonicClocks,即单调时间,所谓单调,就是只会不停的往前增长,不受校时操作的影响,这个时间是自进程启动以来的秒数参考文章:https://www.simpleapples.com/2018/10/......
  • 雪花算法(SnowFlake)
    简介现在的服务基本是分布式、微服务形式的,而且大数据量也导致分库分表的产生,对于水平分表就需要保证表中id的全局唯一性。对于MySQL而言,一个表中的主键id一般使用......
  • 分布式ID生成-雪花算法(Snowflake)
    1描述使用原生Java方式生成雪花算法,雪花算法是推特公司开源的生成唯一ID的算法,性能更高,可以避免对第三方依赖的使用,减少耦合  1)能满足高并发分布式系统环境下I......
  • SnowFlake 高可用的ID 生产方案
    SnowFlakeTwitter的雪花算法SnowFlake,使用Java语言实现。SnowFlake算法用来生成64位的ID,刚好可以用long整型存储,能够用于分布式系统中生产唯一的ID,并且生成的ID有大致的......
  • SnowFlake 雪花算法详解与实现 & MP中的应用
    BackGround现在的服务基本是分布式,微服务形式的,而且大数据量也导致分库分表的产生,对于水平分表就需要保证表中id的全局唯一性。对于MySQL而言,一个表中的主键id一般......