Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #26 2012-02-12 05:18:45

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

(m-m+1)???

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #27 2012-02-12 07:09:54

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Looks like a typo,

Since m>=n it probably should read (m-n+1).

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #28 2012-02-17 01:58:06

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

In planar rectangular integer grid dimension n x m (are nm squares). How many different squares are in this grid which have corners on integer coordinate (sides of this squares doesn't have to be parallel with sides of grid) ?

INPUT:
In first and only row of standard input are two numbers n and m - dimension of rectangular grid (1 <= n, m <= 10^9).

OUTPUT:
Let K be needed number of squares. On standard input write modulo with division K with 10^9 + 7.

Notes:
In 40% tests 1 <= n, m <= 100
In 60% tests 1 <= n, m <= 1.000
In 80% tests 1 <= n, m <= 1.000.000

Input:
2 3

Output:
10

Input:
500 501

Output:
271062715

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #29 2012-02-17 02:06:45

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

I am not following you what are you looking for that was not already given?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #30 2012-02-17 02:14:38

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

well the complexity of the algorithm that solves this problem should be O(1) as i was told.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #31 2012-02-17 02:25:35

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

You mean a linear function?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #32 2012-02-17 02:31:50

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

yes.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #33 2012-02-17 02:36:42

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Just fit a straight line between the two points you know and interpolate between them.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #34 2012-02-17 03:10:11

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

what do you mean?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #35 2012-02-17 08:19:44

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

You have:

(23,10) and (500501,271062715)

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #36 2012-02-17 09:10:12

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

hi bobbym

the should algorithm should always have the same execution time.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #37 2012-02-17 09:12:30

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

That is where I am getting confused, an algorithm could be a process, like a computer program.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #38 2012-02-17 09:19:40

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

yes,and that is what i need.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #39 2012-02-17 11:14:15

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Hi anonimnystefy;

In order for a an algorithm to have about the same execution time it would have to be a formula.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #40 2012-02-17 11:42:50

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

that's what i'm looking for

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #41 2012-02-17 13:04:33

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Hi;

How many do you count for this?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #42 2012-02-18 02:16:51

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

hi bobbym

24. that's including the tilted squares,because that problem says to include those.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #43 2012-02-18 07:03:26

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

I can do better than that, I see 26 but the formula I have sees 30...

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #44 2012-02-18 07:29:05

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

oh,i forgot some sqrt(2)*sqrt(2) squares.sorry.

so what would the formula be?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #45 2012-02-18 07:53:01

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Your new total then is 26?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #46 2012-02-18 08:01:47

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

no,it's 30.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #47 2012-02-18 08:03:43

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Very good! The old have very sharp eyes indeed.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #48 2012-02-18 08:06:23

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

there are the ones with sides of sqrt(3),sqrt(2) and 1.

the old have sharp eyes?you're confusing me now.you told me you were 8 or 9 years old.

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

## #49 2012-02-18 08:07:40

bobbym
From: Bumpkinland
Registered: 2009-04-12
Posts: 107,133

### Re: @MIF , Activity:Drawing squares

Yes, and to me you are an old timer. Ready for retirement. But with sharp eyes.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #50 2012-02-18 08:18:26

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,018

### Re: @MIF , Activity:Drawing squares

ok.so what's the conclusion on this? what's the formula?

Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline