A1328 | [COCI-2015_2016-contest7]#5 PROSTI
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Mirko and his older brother Slavko are playing a game. At the beginning of the game, they pick three numbers K, L, M. In the first and only step of the game, each of them picks their own K consecutive integers.
Slavko always picks the first K integers (numbers 1, 2, ..., K). Mirko has a special demand – he wants to choose his numbers in a way that there are exactly L happy numbers among them. He considers a number happy if it meets at least one of the following requirements:
• the number is smaller than or equal to M
• the number is prime Out of respect to his older brother, L will be smaller than or equal to the total number of happy numbers in Slavko’s array of numbers.
They will play a total of Q games with different values K, L, M. For each game, help Mirko find an array that meets his demand.
Slavko always picks the first K integers (numbers 1, 2, ..., K). Mirko has a special demand – he wants to choose his numbers in a way that there are exactly L happy numbers among them. He considers a number happy if it meets at least one of the following requirements:
• the number is smaller than or equal to M
• the number is prime Out of respect to his older brother, L will be smaller than or equal to the total number of happy numbers in Slavko’s array of numbers.
They will play a total of Q games with different values K, L, M. For each game, help Mirko find an array that meets his demand.
输入格式
The first line of input contains Q (1 6 Q 6 100 000). Each of the following Q lines contains three integers, the i th line containing integers Ki , Li , Mi (1 6 Ki , Mi 6 150, 0 6 Li 6 Ki) that determine the values K, L, M that will be used in the i th game.
输出格式
Output Q lines, the i th line containing an integer, the initial number of Mirko’s array in the i th game.
If an array with the initial number being smaller than or equal to 10 000 000 does not exist, output −
1. If there are multiple possible solutions, output any.
If an array with the initial number being smaller than or equal to 10 000 000 does not exist, output −
1. If there are multiple possible solutions, output any.
输入输出样例
输入 #1
3 1 1 1 2 0 2 3 1 1
输出 #1
1 8 4
输入 #2
3 4 1 1 5 2 3 5 0 3
输出 #2
6 4 24
输入 #3
4 7 2 5 6 1 1 10 4 5 6 2 2
输出 #3
6 20 5 4
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted