A10464 | International Olympiad
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where $y$ stands for some number of consequent last digits of the current year. Organizers always pick an abbreviation with non-empty string $y$ that has never been used before. Among all such valid abbreviations they choose the shortest one and announce it to be the abbreviation of this year's competition.
For example, the first three Olympiads (years 1989, 1990 and 1991, respectively) received the abbreviations IAO'9, IAO'0 and IAO'1, while the competition in 2015 received an abbreviation IAO'15, as IAO'5 has been already used in 1995.
You are given a list of abbreviations. For each of them determine the year it stands for.
For example, the first three Olympiads (years 1989, 1990 and 1991, respectively) received the abbreviations IAO'9, IAO'0 and IAO'1, while the competition in 2015 received an abbreviation IAO'15, as IAO'5 has been already used in 1995.
You are given a list of abbreviations. For each of them determine the year it stands for.
输入格式
The first line of the input contains a single integer $n$ ( $1<=n<=1000$ ) — the number of abbreviations to process.
Then $n$ lines follow, each containing a single abbreviation. It's guaranteed that each abbreviation contains at most nine digits.
Then $n$ lines follow, each containing a single abbreviation. It's guaranteed that each abbreviation contains at most nine digits.
输出格式
For each abbreviation given in the input, find the year of the corresponding Olympiad.
输入输出样例
输入 #1
5 IAO'15 IAO'2015 IAO'1 IAO'9 IAO'0
输出 #1
2015 12015 1991 1989 1990
输入 #2
4 IAO'9 IAO'99 IAO'999 IAO'9999
输出 #2
1989 1999 2999 9999
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted