[Java] Aizu Online Judge's story 1

Recruitment: Good idea

In front of a small story Aside from the fact that the real intention of wanting an idea is completely visible ...

The problem is http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0008 The problem of ** Sum of 4 Integers **. Some of the problems with AOJ are simple, but there are quite a few problems with bones. This problem is early, so it's a simple category.

*** Roughly speaking ... ***

There are 0 or more and 36 or less ** "manju" ** and 3 ** "partitions" **. Insert a ** "partition" ** between this ** "manju" ** and ** "manju" **. However, there may be no ** "manju" ** between ** "partition" ** and ** "partition" **, There must be no more than 10 ** "manju" **.

It's hard to understand, so if you explain it with a figure image

Since the place to put the partition is decided,

Assuming that the smaller number of steamed buns and 36-the number of steamed buns is ** A **,

_{A+3}C_{3}

The number of partitions will come out

*** Do you think? *** ***

The answer is ** "I can't get it" **

Because

Choose four numbers 0-9 (you can choose the same number)

10^4=10000 streets

Exists. But,

_{A+3}C_{3}

When you ask for an answer,

2\sum_{A=0}^{17} (_{A+3}C_{3})=2(1+4+10+20+35+56+84+120+165+220+286+364+455+560+680+816+969+1140) ....①\\
_{18+3}C_{3}=1330....②\\
①+②=13300

In other words, there are ** 3300 combinations of mysteries **. This mysterious combination When there are 10 or more ** "manju" ** in the space separated by the partition.

What should I do to count this?

We look forward to your thinking!

** Of course, the author himself is also thinking about it. ** ** ** As soon as I have an idea, I would like to give it to Rakugo 2. ** ** ** Stay tuned! (Who got) **

↓ I wrote a small story 2!

http://qiita.com/66zaha_9su/items/1d4b884a7936e60bc903

Recommended Posts

[Java] Aizu Online Judge's story 2
[Java] Aizu Online Judge's story 1
Java static story
Java initializer story
Java generic story
Lombok's Java 9+ support story
C # and Java Overrides Story
[Java version] The story of serialization
A really scary (Java anti-pattern) story
Story of passing Java Gold SE8
[Java] Really scary switch statement story