与‘基础算法-枚举’有关的日志

uva10976

maksyuki 发表于 oj 分类,标签:
0
uva10976

It is easy to see that for every fraction in the form 1/k(k > 0), we can always find two positive integers x and y, x ≥ y, such that: 1/k= 1/x + 1/y

Now our question is: can you write a program that counts how many such pairs of x and y there ar >>继续阅读

uva11059

maksyuki 发表于 oj 分类,标签:
0
uva11059

Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive terms of S. If you cannot find a positive sequence, you should consider 0 as the value of the maximum >>继续阅读

uva725

maksyuki 发表于 oj 分类,标签:
0
uva725

Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0 through 9 once each, such that the first number divided by the second is equal to an integer N, where 2 ≤ N ≤ 79. That is,

abcde / fghij = N, wh >>继续阅读

uva1596

maksyuki 发表于 oj 分类,标签: ,
0
uva1596

In this problem, we consider a simple programming language that has only declarations of onedimensional integer arrays and assignment statements. The problem is to find a bug in the given program.

The syntax of this language is given in BNF as foll >>继续阅读

uva1595

maksyuki 发表于 oj 分类,标签:
0
uva1595

The figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut the figure into two identical halves. The figure on the right is not left-right symmetric as i >>继续阅读

uva1594

maksyuki 发表于 oj 分类,标签:
0
uva1594

A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, · · · , an), the next n-tuple in the sequence is formed by taking the absolute differences of neighboring integers:

(a1, a2, · · · , an) → (|a1 − a2|, |a2 >>继续阅读

uva1591

maksyuki 发表于 oj 分类,标签:
0
uva1591

Dr. Tuple is working on the new data-mining application for Advanced Commercial Merchandise Inc. One of the subroutines for this application works with two arrays P and Q containing N records of data each (records are numbered from 0 to N − 1). Array >>继续阅读

uva508

maksyuki 发表于 oj 分类,标签:
0
uva508

Samuel F. B. Morse is best known for the coding scheme that carries his name. Morse code is still used in international radio communication. The coding of text using Morse code is straightforward. Each character (case is insignificant) is translated >>继续阅读

uva253

maksyuki 发表于 oj 分类,标签:
0
uva253

We have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of these colors. The cube’s faces are numbered as in Figure 1.

Since a cube has 6 faces, our machine can paint a f >>继续阅读

hdu1395

maksyuki 发表于 oj 分类,标签: ,
0
hdu1395

2^x mod n = 1

Problem Description

Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1. >>继续阅读