src2020/1666_erfen/Readme.md
2020-04-30 18:02:24 +08:00

25 lines
597 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 二分
[问题描述]
教学案例,必须使用递归函数完成求解!
  在n个整数已经按从小到大排好序中查找m个整数的位置。若存在则输出其位置若不存在则输出-1。
  其中( n <= 10^5 m <= 10^4 )。
[输入格式]
  第1行两个整数值n和m。
  第2行共n个整数值已经按从小到大顺序排好数值之间用一个空格间隔每个值均小于10^9。
  第3行共m个整数值数值之间用一个空格间隔。
[输出格式]
  共m行每行一个整数值表示找到该数在n个数中的位置第一个数的位置从1开始编号若不存在输出-1。
[输入样例]
5 2
12 25 67 98 123
23 67
[输出样例]
-1
3