Maison > base de données > tutoriel mysql > le corps du texte

Codeforces Round #218 (Div. 2) D. Vessels

WBOY
Libérer: 2016-06-07 15:49:38
original
1251 Les gens l'ont consulté

There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n , in the order from the highest to the lowest, the volume of the i -th vessel is a i liters. Initial

There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ailiters.

 

Codeforces Round #218 (Div. 2) D. Vessels

 

Initially, all the vessels are empty. In some vessels water is poured. All the water that overflows from the i-th vessel goes to the (i + 1)-th one. The liquid that overflows from the n-th vessel spills on the floor.

Your task is to simulate pouring water into the vessels. To do this, you will need to handle two types of queries:

 

  1. Add xi liters of water to the pi-th vessel;
  2. Print the number of liters of water in the ki-th vessel.

 

When you reply to the second request you can assume that all the water poured up to this point, has already overflown between the vessels.

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal