mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-14 04:15:54 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+40
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _600B
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static int FindFirstIndexGreaterThanOrEqualTo(ref List<int> sortedCollection, int key)
|
||||
{
|
||||
int begin = 0;
|
||||
int end = sortedCollection.Count;
|
||||
while (end > begin)
|
||||
{
|
||||
int index = (begin + end) / 2;
|
||||
int el = sortedCollection[index];
|
||||
if (el > key)
|
||||
end = index;
|
||||
else
|
||||
begin = index + 1;
|
||||
}
|
||||
return end;
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string s = Console.ReadLine();
|
||||
//int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
//int[] b = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
List<int> a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
|
||||
List<int> b = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
|
||||
a.Sort();
|
||||
for (int i = 0; i < b.Count; i++)
|
||||
{
|
||||
Console.Write("{0} ", FindFirstIndexGreaterThanOrEqualTo(ref a, b[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user