# 1017 - Gasto de Combustível

## Descrição

{% embed url="<https://www.urionlinejudge.com.br/judge/pt/problems/view/1017>" %}

## Solução

A resolução desse problema envolve duas etapas:

1. Calcular a distância percorrida pelo carro, que pode ser calculada multiplicando a velocidade (em km/h) pelo tempo (em horas);
2. Como o carro faz 12 km/L, pegar a distância percorrida (em km) e dividir por 12 (km/L) para descobrir quantos litros precisa para percorrer a viagem no tempo e velocidade passados.

{% tabs %}
{% tab title="C99" %}

```c
#include <stdio.h>

int main(){
    int tempo, velocidade, distancia;
    double litros;

    scanf("%d\n%d", &tempo, &velocidade);

    distancia = velocidade * tempo;
    litros = distancia/12.0;

    printf("%.3lf\n", litros);

    return 0;
}
```

{% endtab %}

{% tab title="C++17" %}

```cpp
#include <iostream>
#include <iomanip>

using namespace std;

int main(){
    int tempo, velocidade, distancia;
    double litros;

    cin >> tempo >> velocidade;

    distancia = velocidade * tempo;
    litros = distancia/12.0;

    cout << setprecision(3) << fixed << litros << endl;

    return 0;
}
```

{% endtab %}

{% tab title="JavaScript 12.18" %}

```javascript
let input = require("fs").readFileSync("/dev/stdin", "utf8");
let lines = input.split("\n");

let tempo = parseInt(lines.shift());
let velocidade = parseInt(lines.shift());

let distancia = tempo * velocidade;
let litros = distancia / 12;

console.log(litros.toFixed(3));
```

{% endtab %}

{% tab title="Python 3.9" %}

```python
tempo = int(input())
velocidade = int(input())

distancia = tempo * velocidade
litros = distancia/12

print(f"{litros:.3f}")
```

{% endtab %}
{% endtabs %}


---

# 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://xtecna.gitbook.io/solucoes-da-beecrowd/iniciante/1017-gasto-de-combustivel.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.
