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

You are not logged in.

- Topics: Active | Unanswered

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

(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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

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.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

Task :: Kvadratici

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

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.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

You mean a linear function?

**In mathematics, you don't understand things. You just get used to them.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

yes.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

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

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

what do you mean?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

You have:

(23,10) and (500501,271062715)

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

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.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

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

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

yes,and that is what i need.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

Hi anonimnystefy;

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

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

that's what i'm looking for

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

Hi;

How many do you count for this?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

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.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

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

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

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.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

Your new total then is 26?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

no,it's 30.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

Very good! The old have very sharp eyes indeed.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

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.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 82,990

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

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 14,883

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.

Offline