- 博客(34)
- 收藏
- 关注
转载 SGU[144] Meeting
Description描述Two of the three members of the winning team of one of the ACM regional contests are going to meet in order to train for the upcoming World Finals. They decided that they will me...
2015-07-22 20:46:00 140
转载 SGU[116] Index of super-prime
Description描述Let P1, P2, … ,PN, … be a sequence of prime numbers. Super-prime number is such a prime number that its current number in prime numbers sequence is a prime number too. For exampl...
2015-07-20 13:39:00 165
转载 专题一、简单搜索 - Virtual Judge
很久以前刷完了Virtual Judge上的简单搜索专题,现总结如下:POJ 1321由于题目的数据范围比较小,可以直接dfs暴力。读入时记录每个空位的位置,保存在pX[]以及pY[]数组中。暴力的时候统计当前处理第几个空格以及当前处理到了第几行即可。#include <iostream>#include <memory.h>us...
2015-06-08 21:57:00 306
转载 Dynamic Programming - HDU
最近主要刷一下动态规划专题,题目来自于HDU。HDU 2955这是一道概率DP,我第一次的想法是把概率P乘以100,变成一个背包然后做0-1背包,后来发现这样做是错误的。原因:概率应该是相乘,而不是相加。后来看了题解想到了另外一种方法,使用逃脱概率来计算,用f[j]表示偷走j价值后逃脱的概率。易知,多次逃脱概率为每次逃脱概率相乘。这里不使用被逮捕的概率是因为被逮...
2015-03-14 13:22:00 132
转载 SGU[114] Telecasting station
Description描述Every city in Berland is situated on Ox axis. The government of the country decided to build new telecasting station. After many experiments Berland scientists came to a conclusi...
2015-03-13 19:37:00 244
转载 SGU[222] Little Rooks
Description描述Inspired by a "Little Bishops" problem, Petya now wants to solve problem for rooks.A rook is a piece used in the game of chess which is played on a board of square grids. A roo...
2015-03-07 14:26:00 96
转载 SGU[154] Factorial
Description描述You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For example, 5! = 120, 120 contai...
2015-03-07 13:18:00 129
转载 SGU[130] CIrcle
Description描述On a circle border there are 2k different points A1, A2, ..., A2k, located contiguously. These points connect k chords so that each of points A1, A2, ..., A2k is the end point of...
2015-03-07 11:04:00 107
转载 SGU[276] Andrew's Troubles
Description描述Famous Berland ACM-ICPC team Anisovka consists of three programmers: Andrew, Michael and Ilya. A long time ago, during the first few months the team was founded, Andrew was very ...
2015-03-07 09:48:00 105
转载 SGU[126] Boxes
Description描述There are two boxes. There are A balls in the first box, and B balls in the second box (0 < A + B < 2147483648). It is possible to move balls from one box to another. From ...
2015-03-07 09:28:00 128
转载 SGU[118] Digital Root
Description描述Let 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 otherwise digital root of n is equal to digital root of f(n). ...
2015-02-24 15:18:00 106
转载 SGU[117] Counting
Description描述Find amount of numbers for given sequence of integer numbers such that after raising them to theM-th power they will be divided byK.求出给定一个包含N个整数的序列,其中某个数字的M次方能被K整除的数的个数。...
2015-02-24 14:14:00 75
转载 SGU[104] Little shop of flowers
Description描述You want to arrange the window of your flower shop in a most pleasant way. You haveFbunches of flowers, each being of a different kind, and at least as many vases ordered in a ...
2015-02-24 13:33:00 110
转载 SGU[101] Domino
Description描述Dominoes – game played with small, rectangular blocks of wood or other material, each identified by a number of dots, or pips, on its face. The blocks usually are called bones, d...
2015-02-22 15:14:00 196
转载 SGU[347] Join the Strings
Description描述His Royal Highness King of Berland Berl XV was a very wise man and had a very accomplished wife, who was aware of the fact, that prominent and outstanding personalities once havi...
2015-02-22 13:10:00 149
转载 SGU[151] Construct a triangle
Description描述Find coordinates of any triangle ABC if it is know that |AB|=c, |AC|=b, |AM|=m, AM is a median of triangle.找到任何一个三角形ABC,使得它满足|AB| = c,|AC| = b,|AM| = m,其中AM为三角形的中线。Input...
2015-02-22 12:33:00 131
转载 SGU[180] Inversions
Description描述There are N integers (1<=N<=65537) A1, A2,.. AN (0<=Ai<=10^9). You need to find amount of such pairs (i, j) that 1<=i<j<=N and A[i]>A[j].给定N (1 <= N ...
2015-02-17 11:58:00 97
转载 寒假练习 07
断断续续终于刷完了计算几何专题,感觉太麻烦,小错误不断,尤其是精度问题。还有输出问题,有时候printf比cout要方便。UVaOJ 10250给出正方形的一组对角坐标,求另外两个坐标,用三角函数推到公式。不妨设两点为A(x1, y1), C(x2, y2),则中点为G((x1 + x2) / 2, (y1 + y2) / 2),对角线长度为L = sqrt((x1 -...
2015-02-17 11:37:00 82
转载 寒假练习 06
这一次主要是数论专题,感到思维量比上一次的数学题要多多了。同样的问题也是英文题看起来有些吃力。UVaOJ 575这应该算不上是一个数论题,它重新定义了一种进制转换的公式,然后根据公式计算即可。#include <iostream>using namespace std;int Pow(int x, int y);int main(...
2015-02-13 12:50:00 108
转载 寒假练习 05
刷完了数学专题,感觉思维量有些大,同时也对浮点数的运算有些接触。最重要的还是感觉有时候题目读起来有些吃力,需要借助中文翻译。UVaOJ 113这道题目是集训的时候第一天晚上的题目,据说可以double解决,当时没有AC。现在重新做了一遍,需要注意的是最后输出的结果一定要转换成int,否则会WA。同时,double转换为int的时候可以采取这样的方式:(int)flo...
2015-02-12 14:24:00 102
转载 寒假练习 04
断断续续的把排序和检索专题刷完了,感觉英语还是不够,题目太长以后看起来就会很吃力。还有一点感触就是STL的广泛应用。学到了很多新东西。当然,不能忍受的就是答案最后多输出一行空行,UVaOJ会判WA。UVaOJ 340简单模拟题,一开始没有看懂题目。百度以后才明白的题意。朴素模拟以后即可得到答案。#include <iostream>#incl...
2015-02-11 17:18:00 91
转载 寒假练习 03
今天刷了高精度专题,本来准备写一个高精度类,然后直接套模版,后来发现根据每题的要求分开写高精度反而效率高。主要涉及了高精度加法、乘法、除法、取余(其中后两项为高精度和低精度进行运算)。终于打过一遍高精度除以低精度了,高精度专题也算圆满了。UVaOJ 424高精度加法,水题。#include <iostream>#include <str...
2015-02-08 14:02:00 110
转载 寒假练习 02
今天刷了小白书的字符串专题,各种WA以及PE。UVaOJ中有时候会把PE判成WA,这样会导致很难查错。UVa 401这道题目有个坑,只有表格中列出的才是镜像字母,没有列出了的表示没有镜像字母,在这上WA了一次。#include <iostream>#include <string>using namespace std;cons...
2015-02-07 19:29:00 114
转载 SGU[127] Telephone directory
Description描述CIA has decided to create a special telephone directory for its agents. The first 2 pages of the directory contain the name of the directory and instructions for agents, telephon...
2015-02-05 21:30:00 115
转载 SGU[112] a^b-b^a
Description描述You are given natural numbers a and b. Find ab-ba.给定自然数a、b,求ab-ba。Input输入Input contains numbers a and b (1≤a,b≤100).输入文件包含a和b(0<a,b<=100)。Output输出Write a...
2015-02-05 14:52:00 199
转载 SGU[113] Nearly prime numbers
Description描述Nearly prime number is an integer positive number for which it is possible to find such primesP1andP2that given number is equal toP1*P2. There is given a sequence onNinteg...
2015-02-05 14:46:00 105
转载 SGU[107] 987654321 problem
Description描述For given number N you must output amount of N-digit numbers, such, that last digits of their square is equal to 987654321.对于任意给定的数N,你需要输出平方的末尾为987654321的N位数的个数。Input输入...
2015-02-05 14:33:00 121
转载 SGU[184] Patties
Description描述Petya is well-known with his famous cabbage patties. Petya's birthday will come very soon, and he wants to invite as many guests as possible. But the boy wants everybody to try h...
2015-01-30 17:49:00 185
转载 SGU[135] Drawing Lines
Description描述Little Johnny likes to draw a lot. A few days ago he painted lots of straight lines on his sheet of paper. Then he counted in how many zones the sheet of paper was split by these...
2015-01-29 21:33:00 134
转载 SGU[115] Calendar
Description描述First year of new millenium is gone away. In commemoration of it write a program that finds the name of the day of the week for any date in 2001.千禧年过后的第一年已经过去了。为了纪念它,请你写一个程序来计算...
2015-01-29 21:18:00 81
转载 SGU[123] The sum
Description描述The Fibonacci sequence of numbers is known: F1= 1; F2= 1; Fn+1= Fn+ Fn-1, for n>1.You have to find S - the sum of the first K Fibonacci numbers.斐波那契数列广为大家所知:F1= 1; F2...
2015-01-29 21:03:00 93
转载 SGU[105] Div 3
Description描述There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of numbers in it that are divisible by 3.给定数列 1, ...
2015-01-29 20:48:00 86
转载 SGU[102] Coprimes
Description描述For given integer N (1<=N<=10^4) find amount of positive numbers not greater than N that coprime with N. Let us call two positive integers (say, A and B, for example) copri...
2015-01-29 20:17:00 123
转载 SGU[100] A+B
Description描述Read integers A and B from input file and write their sum in output file.从输入文件中读入整数A和B并且将他们的和输出在输出文件上。Input输入Input file contains A and B (0<A,B<10001).输入文件包含A和...
2015-01-29 20:08:00 89
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人