上一页 1 ··· 75 76 77 78 79 80 81 82 83 ··· 90 下一页
摘要: 一个数组A中存有N(N&gt0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A~0~ A~1~……A~N-1~)变换为(A~N-M~ …… A~N-1~ A~0~ A~1~……A~N-M-1~)(最后M个数循环移至最前面的M个位置)。如果需要考虑 阅读全文
posted @ 2018-07-24 16:05 王清河 阅读(132) 评论(0) 推荐(0)
摘要: 让我们定义 dn 为:dn = pn+1 - pn,其中 pi 是第i个素数。显然有 d1=1 且对于n>1有 dn 是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。 现给定任意正整数N (< 105),请计算不超过N的满足猜想的素数对的个数。 输入格式:每个测试输入包含1个测试用例, 阅读全文
posted @ 2018-07-24 16:03 王清河 阅读(347) 评论(0) 推荐(0)
摘要: 卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹 阅读全文
posted @ 2018-07-24 16:00 王清河 阅读(150) 评论(0) 推荐(0)
摘要: 卡拉兹(Callatz)猜想: 对任何一个自然数n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把(3n+1)砍掉一半。这样一直反复砍下去,最后一定在某一步得到n=1。卡拉兹在1950年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学 阅读全文
posted @ 2018-07-24 15:57 王清河 阅读(106) 评论(0) 推荐(0)
摘要: “答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;\ 现在就请你为PAT写一个自动裁 阅读全文
posted @ 2018-07-24 15:52 王清河 阅读(114) 评论(0) 推荐(0)
摘要: Given a sequence of K integers { N~1~, N~2~, ..., N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, ..., N~j~ } where 1 <= i <= j <= K 阅读全文
posted @ 2018-07-24 11:04 王清河 阅读(99) 评论(0) 推荐(0)
摘要: Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gainin 阅读全文
posted @ 2018-07-23 11:01 王清河 阅读(147) 评论(0) 推荐(0)
摘要: A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as po 阅读全文
posted @ 2018-07-22 15:49 王清河 阅读(477) 评论(0) 推荐(0)
摘要: According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. At each iteration, ins 阅读全文
posted @ 2018-07-15 18:06 王清河 阅读(133) 评论(0) 推荐(0)
摘要: When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A "soci 阅读全文
posted @ 2018-07-15 11:23 王清河 阅读(144) 评论(0) 推荐(0)
上一页 1 ··· 75 76 77 78 79 80 81 82 83 ··· 90 下一页