โ† run

lcb-0081

1.000
3/3 testsยท algorithms

Proposed solution

I'll solve this step by step.

## Problem Understanding

We need to arrange 400 people in a rectangular formation with A rows and B columns.
- Total people = A ร— B = 400
- We're given A, need to find B such that A ร— B = 400
- If no such positive integer B exists, return -1

## Mathematical Analysis

For A ร— B = 400:
- B = 400 / A
- For B to be a positive integer, A must be a divisor of 400

So we need to check if A divides 400 evenly.

## Step-by-step Solution

1. Read A from input
2. Check if 400 is divisible by A
3. If yes, calculate B = 400 / A
4. If no, return -1

Let me verify with the examples:
- Example 1: A = 10, 400 รท 10 = 40 โœ“
- Example 2: A = 11, 400 รท 11 = 36.36... (not integer) โ†’ -1 โœ“  
- Example 3: A = 400, 400 รท 400 = 1 โœ“

## Implementation

```python
A = int(input())

if 400 % A == 0:
    B = 400 // A
    print(B)
else:
    print(-1)
```

Let me trace through the examples:
- Input: 10 โ†’ 400 % 10 = 0, so B = 400 // 10 = 40 โ†’ Output: 40 โœ“
- Input: 11 โ†’ 400 % 11 = 4, so 400 is not divisible by 11 โ†’ Output: -1 โœ“
- Input: 400 โ†’ 400 % 400 = 0, so B = 400 // 400 = 1 โ†’ Output: 1 โœ“

The solution looks correct!

Test output (stdout)

...                                                                      [100%]
3 passed in 0.05s
System prompt
You are an expert programmer. Solve the task exactly as specified. Output your solution as fenced code blocks using the required file name(s) and the exact function/type signatures requested. Prefer correctness; do not include prose outside code unless asked.