`
yzd
  • 浏览: 1818688 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

1002. Anti-prime Sequences

 
阅读更多

TAG 搜索 回溯 深度优先

之前看了这题目,毫无头绪,所以搁置了很久,到最近才ac掉。

这种题目,应该是没办法用数学方法推算的,就算有,我想我也推不出。不过1000个数的全排列太大了,用搜索好像又会超时。但仔细分析又发现,条件比较苛刻,all consecutive subsequences of length 2,3,...,d sum to a composite number,也就是说,从2到d的子序列都要满足,不单单d长度的。 /*我一开始理解错了*/ 这样的话,能大量剪枝,保证不会超时。而且只需找到一个字典序最小的解,也提示我们应该是按字典序进行深搜。

所以仔细分析后,大胆深搜就可以ac了。这也启示我今后看到问题不要轻言放弃,要仔细分析,不要被题目表象迷惑,说不定只是水题一道。

(^ω^)


分享到:
评论

相关推荐

    Mitov LabPacks6Delphi XE2-XE4 Full Source

    Jukeboxes, and Play Lists - play sequences with cool transition effects. Transparency - mix videos by using transparent colors. Broadcast - compress and broadcast the video. Playback - create playback...

    numpy-user.pdf

    sequences. •AgrowingplethoraofscientificandmathematicalPython-basedpackagesareusingNumPyarrays;though thesetypicallysupportPython-sequenceinput,theyconvertsuchinputtoNumPyarrayspriortoprocessing, ...

    PowerShell-7.0.0-preview.4-win-x64.msi

    Update console host to support XTPUSHSGR/XTPOPSGR VT control sequences that are used in composability scenarios. (#10208) Add WorkingDirectory parameter to Start-Job (#10324) (Thanks @davinci26!) ...

    The Art of Assembly Language Programming

    You are visitor as of October 17, 1996. The Art of Assembly Language Programming <br>Forward Why Would Anyone Learn This Stuff? 1 What's Wrong With Assembly Language 2 What's Right With ...

    Labview TestStand教程

    How to Create Test Sequences ...................................................................................3-2 Action 1 : Specify the Adapter ........................................................

    algorithms-on-strings-trees-and-sequences.part3

    The book is a general, rigorous text on deterministic algorithms that operate on strings, and sequences. It covers the full spectrum of string algorithms from clasical computer science to modern ...

    随机信号分析:5-Random Sequences2017.ppt

    随机信号分析:5-Random Sequences2017.ppt

    algorithms-on-strings-trees-and-sequences.part2

    The book is a general, rigorous text on deterministic algorithms that operate on strings, and sequences. It covers the full spectrum of string algorithms from clasical computer science to modern ...

    algorithms-on-strings-trees-and-sequences.part1

    The book is a general, rigorous text on deterministic algorithms that operate on strings, and sequences. It covers the full spectrum of string algorithms from clasical computer science to modern ...

    Computer Vision Using Local Binary Patterns

    Recognition and segmentation of dynamic textures.- Background subtraction.- Recognition of actions.- Face analysis using still images.- Face analysis using image sequences.- Visual recognition of ...

    QUASI-SYNCHRONOUS MULTICARRIER DS-CDMA USING Z-COMPLEMENTARY SEQUENCES.pdf

    QUASI-SYNCHRONOUS MULTICARRIER DS-CDMA USING Z-COMPLEMENTARY SEQUENCESpdf,QUASI-SYNCHRONOUS MULTICARRIER DS-CDMA USING Z-COMPLEMENTARY SEQUENCES

    Sakemail

    1997 - 2003 Sergio A.... Some minor bugs that I don‘t remember fixed.- Added MIME-compliant base64 support (not for use by now). Added examples.0.9.2.1b- Fixed a bug when send a mail and the first line ...

    convmv-1.15.tar.gz

    this option will remove this ugly % hex sequences from filenames and turn them into (hopefully) nicer 8-bit characters. After --unescape you might want to do a charset conversion. This sequences like ...

    Python库 | django_sequences-2.4-py2.py3-none-any.whl

    资源分类:Python库 所属语言:Python 资源全名:django_sequences-2.4-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    Hibernate Reference Documentation3.1

    Identity columns and sequences 5.1.4.5. Assigned identifiers 5.1.4.6. Primary keys assigned by triggers 5.1.5. composite-id 5.1.6. discriminator 5.1.7. version (optional) 5.1.8. timestamp (optional) ...

    Sylenth1+v2.21 for mac

    Robert Todd - 02 - Future Sequences.fxb SDM Dubstep Presets Sylenth1 V1.fxb serendipity.fxb Shockwave - Artist series - Totalwarz vol 1 & 2.fxb Simon Foster Polar Virus 1 SoundBank.fxb Simon Foster ...

    Golay_sequences.rar_Golay sequences_golay_golay codes

    golay codes and sequences

    api-sequences.csv

    api-sequences.csv

Global site tag (gtag.js) - Google Analytics