D
指定した配列(sorted)に指定された値が含まれているかどうかを判定するやつ bool binarysearch(int[] a, int x) { if(a.length==0) return false; if(a[0]==x || a[$-1]==x) return true; uint from = 0; uint to = cast(uint)(a.length-1); while(to-from>1…
指定した配列(sorted)に指定された値が含まれているかどうかを判定するやつ bool binarysearch(int[] a, int x) { if(a.length==0) return false; if(a[0]==x || a[$-1]==x) return true; uint from = 0; uint to = cast(uint)(a.length-1); while(to-from>1…