PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000283. Giới hạn tin nhắn (Chat Ban)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Giới hạn tin nhắn (Chat Ban)
Chat Ban
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
You plan to send messages containing emotes, respectively. Sending stops after the message that brings the cumulative emote count to at least ; that message is included. If no ban occurs, all messages are sent. Find how many messages are sent.
Input
One line contains integers .
Output
Print the number of messages sent.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; .
Examples
Input 1
3 7
Output 1
4
Explanation
The totals after 3 and 4 messages are 6 and 8.
Input 2
2 5
Output 2
3
Explanation
All three messages sum to 4, below 5.