自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(127)
  • 收藏
  • 关注

原创 codeforces 1043 F. Make It One 数学?随机?

https://codeforces.com/contest/1043/problem/F没搜到中文题解,看了一下官方题解,翻译解释一发。题意,从n个数中选最少个数的数使得取出的数gcd为1。数据范围是n最大3e5,每个数最大3e5.思路:我们很容易观察出,如果存在可行答案,那么取出数量不超过7,因为最小的7个质数相乘都大于3e5了。然后定义dp[ i ][ j ] 的意义为,取出...

2018-10-30 14:16:37 464

原创 codeforces 999 E. Reachability from the Capital 强连通

E. Reachability from the Capitaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are nn cities and mm roads in Berland. Each road connects a ...

2018-06-29 10:11:07 320

原创 RSA 简单实现

rsa.rb 生成公钥密钥puts "公钥密钥生成程序开始"$bitlen = 1024 # 素数二进制长度$t = 500 # 费马小素性测试次数# 生成随机大整数且为奇数def bignum() len = $bitlen len -= 2 ret = 1 len.times do ret <<= 1 ret += rand(2) end ret &lt...

2018-06-17 22:40:42 1044

原创 cf 617 E. XOR and Favorite Number 莫队算法

E. XOR and Favorite Numbertime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBob has a favorite number k and ai of length n. Now he asks you to answe...

2018-06-10 13:01:35 218

原创 cf 985 F. Isomorphic Strings 字符串hash

F. Isomorphic Stringstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s of length n consisting of lowercase English letters....

2018-05-28 13:30:04 444

原创 sgu 217. Two Cylinders 积分

217. Two Cylinderstime limit per test: 0.5 sec.memory limit per test: 65536 KBinput: standardoutput: standardIn this problem your task is very simple. Consider two infinite cylinders in three-dimensio...

2018-05-27 18:10:06 180

原创 sgu 406. Goggle

406. GoggleTime limit per test: 0.25 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardEverybody knows search engine Goggle. But only advanced users know that it is possible to sear...

2018-05-27 13:56:17 193

原创 sgu 296. Sasha vs. Kate 贪心

296. Sasha vs. KateTime limit per test: 0.5 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardDuring the regular Mars's World Finals Subregional Programming Contest a boy Sasha lost...

2018-05-27 13:25:23 140

原创 sgu 259. Printed PR 贪心

259. Printed PRtime limit per test: 0.25 sec.memory limit per test: 65536 KBinput: standardoutput: standardSmall PR-agency got an order to print a very big lot of agitational materials. Agency should ...

2018-05-27 12:42:05 192

原创 sgu 302. BHTML 1.0 栈

302. BHTML 1.0Time limit per test: 0.25 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardThe hypertext markup language BHTML 1.0 has only two paired tags. They are UP /UP and DOWN ...

2018-05-25 21:03:50 133

原创 sgu 116. Index of super-prime 背包

116. Index of super-primetime limit per test: 0.25 sec. memory limit per test: 4096 KBLet P1, P2, … ,PN, … be a sequence of prime numbers. Super-prime number is such a prime number that its current nu...

2018-05-22 19:02:12 184

原创 sgu 175. Encoding 二分模拟

175. Encodingtime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standardoutput: standardLet phi(W) is the result of encoding for algorithm: 1. If the length of W is 1 then phi(W) is W;...

2018-05-22 15:24:38 126

原创 sgu 127. Telephone directory

127. Telephone directorytime limit per test: 0.25 sec. memory limit per test: 4096 KBCIA has decided to create a special telephone directory for its agents. The first 2 pages of the directory contain ...

2018-05-22 10:51:02 180

原创 sgu 405. Totalizator 简单模拟

405. TotalizatorTime limit per test: 0.25 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardSome time ago Vasya was cleaning up the garret. After the hours of hard work he suddenly ...

2018-05-22 09:51:01 156

原创 sgu 443. Everlasting...? 素数筛

443. Everlasting...?Time limit per test: 0.5 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardEverlasting Sa-Ga, a new, hot and very popular role-playing game, is out on October 1...

2018-05-22 08:47:54 216

原创 sgu 181. X-Sequence 答案出现循环

181. X-Sequencetime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standardoutput: standardLet {xi} be the infinite sequence of integers: 1) x0 = A; 2) xi = (alpha * xi-1^2 + beta * xi-...

2018-05-20 21:24:33 188

原创 sgu 222. Little Rooks 组合数学

222. Little Rookstime limit per test: 0.25 sec.memory limit per test: 65536 KBinput: standardoutput: standardInspired by a "Little Bishops" problem, Petya now wants to solve problem for rooks. A rook ...

2018-05-20 20:18:21 293

原创 sgu 549. Dumbbells 排序

549. DumbbellsTime limit per test: 1 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardA sports shop has n dumbbells in store. Each of them is characterised by its mass mi and cost...

2018-05-20 19:33:37 306

原创 sgu 546. Ternary Password 模拟

546. Ternary PasswordTime limit per test: 1 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardIn the ternary world all passwords are ternary, that is, they consist only of digits "...

2018-05-17 13:04:06 161

原创 sgu 118 Digital Root 数学规律

118. Digital Roottime limit per test: 0.25 sec. memory limit per test: 4096 KBLet f(n) be a sum of digits for positive integer n. If f(n) is one-digit number then it is a digital root for n and otherw...

2018-05-16 19:07:35 237

原创 sgu 134. Centroid 树形dp

134. Centroidtime limit per test: 0.25 sec. memory limit per test: 4096 KBYou are given an undirected connected graph, with N vertices and N-1 edges (a tree). You must find the centroid(s) of the tree...

2018-05-07 21:01:21 174

原创 sgu 538. Emoticons 水

538. EmoticonsTime limit per test: 1 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardA berland national nanochat Bertalk should always stay up-to-date. That's why emoticons highl...

2018-05-07 17:44:31 175

原创 sgu 135. Drawing Lines 找规律

135. Drawing Linestime limit per test: 0.25 sec. memory limit per test: 4096 KBLittle Johnny likes to draw a lot. A few days ago he painted lots of straight lines on his sheet of paper. Then he counte...

2018-05-04 15:59:10 127

原创 sgu 130. Circle 卡特兰数

130. Circletime limit per test: 0.25 sec. memory limit per test: 4096 KBOn a circle border there are 2k different points A1, A2, ..., A2k, located contiguously. These points connect k chords so that e...

2018-05-04 15:31:38 111

原创 sgu 115. Calendar 水

115. Calendartime limit per test: 0.25 sec. memory limit per test: 4096 KBFirst year of new millenium is gone away. In commemoration of it write a program that finds the name of the day of the week fo...

2018-05-03 20:53:14 98

原创 sgu 275. To xor or not to xor 线性基

275. To xor or not to xortime limit per test: 0.25 sec.memory limit per test: 65536 KBinput: standardoutput: standardThe sequence of non-negative integers A1, A2, ..., AN is given. You are to find som...

2018-05-03 20:37:40 155

原创 sgu 398. Friends of Friends 集合set

398. Friends of FriendsTime limit per test: 0.25 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardSocial networks are very popular now. They use different types of relationships to...

2018-05-03 17:15:12 249

原创 sgu 113. Nearly prime numbers 素数

113. Nearly prime numberstime limit per test: 0.25 sec. memory limit per test: 4096 KBNearly prime number is an integer positive number for which it is possible to find such primes P1 and P2 that give...

2018-05-02 20:45:34 134

原创 sgu 101. Domino 欧拉回路

101. Dominotime limit per test: 0.25 sec. memory limit per test: 4096 KBDominoes – game played with small, rectangular blocks of wood or other material, each identified by a number of dots, or pips, o...

2018-05-01 11:40:00 150

原创 sgu 184. Patties 基础

184. Pattiestime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standard inputoutput: standard outputPetya is well-known with his famous cabbage patties. Petya's birthday will come very...

2018-04-30 17:17:41 181

原创 sgu 519. 3D City Model

519. 3D City ModelTime limit per test: 0.25 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardA city is built on the top of a rectangular n x m grid where all the grid cells are eq...

2018-04-30 16:46:05 132

原创 cf 967 c Stairs and Elevators 二分

C. Stairs and Elevatorstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the year of 30XX30XX participants of some world programming championship...

2018-04-30 13:41:06 327

原创 sgu 172. eXam dfs二分图判定

172. eXamtime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standardoutput: standardIn Russia school pupils must do some exams before leaving school. Among others, they must do two "se...

2018-04-30 11:14:14 147

原创 sgu 347. Join the Strings 字符串比较

347. Join the StringsTime limit per test: 0.25 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardHis Royal Highness King of Berland Berl XV was a very wise man and had a very accomp...

2018-04-30 01:55:35 162

原创 sgu 299. Triangle 大数

299. TriangleTime limit per test: 0.5 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardIt is well known that three segments can make a triangle if and only if the sum of lengths of...

2018-04-29 17:41:23 93

原创 sgu 231. Prime Sum 素数筛选

231. Prime Sumtime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standardoutput: standardFind all pairs of prime numbers (A, B) such that A<=B and their sum is also a prime number a...

2018-04-29 16:04:25 178

原创 sgu 133. Border 贪心

133. Bordertime limit per test: 0.25 sec. memory limit per test: 4096 KBAlong the border between states A and B there are N defence outposts. For every outpost k, the interval [Ak,Bk] which is guarded...

2018-04-29 15:31:21 127

原创 sgu 551. Preparing Problem 优先队列或数学方法?

551. Preparing ProblemTime limit per test: 1 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardIt is not easy to prepare a problem for a programming contest. Petya and Vasya decide...

2018-04-29 14:09:09 249

原创 sgu 104. Little shop of flowers 动态规划找方案

104. Little shop of flowerstime limit per test: 0.25 sec. memory limit per test: 4096 KBPROBLEMYou want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers,...

2018-04-29 11:47:29 124

原创 sgu 154. Factorial 二分

154. Factorialtime limit per test: 0.25 sec.memory limit per test: 4096 KBinput: standard inputoutput: standard outputYou task is to find minimal natural number N, so that N! contains exactly Q zeroes...

2018-04-29 09:37:21 115

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除