# Basketball One-on-One

## Question

{% embed url="<https://open.kattis.com/problems/basketballoneonone>" %}

## Solution

### Idea

To solve this question trivially, you can

1. Iterate through the input and record the score for A and score for B
2. And after exiting the loop, check whose score is higher

I haven't tried this solution so I am not sure whether it will work or not. But this solution is **not elegant!** And the more elegant or faster way is to add the following steps to our original solution:

3. If `score_a >= 11 && score_a - score_b >= 2`, that means A wins, print the result, return.
4. If `score_b >= 11 && score_b - score_a >= 2`, that means B wins, print the result, return.

Note that steps 3 and 4 are not in `if/else` relation, that means you need to use two `if` to judge.

### Code

{% @github-files/github-code-block url="<https://github.com/mendax1234/Coding-Problems/blob/main/kattis/basketballoneonone/basketballoneonone.c>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wenbo-notes.gitbook.io/coding/kattis/easy/basketball-one-on-one.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
