Đếm số phong phú

Xem dạng PDF


Bình luận

Hãy đọc nội quy trước khi bình luận.



  • 0
    Artemis18  đã bình luận lúc 20, Tháng 4, 2026, 18:58

    include<bits/stdc++.h>

    define ll long long

    using namespace std; ll i,n,x,a[10000007]; ll tknp(ll x) { ll l,r,mid,kq; l=1; r=n; while(l<=r) { mid=(l+r)/2; if(a[mid]>=x) { kq=a[mid]; r=mid-1; } else l=mid+1; } return kq; } int main() { iosbase::syncwith_stdio(0); cin.tie(0);cout.tie(0); freopen("s.inp","r",stdin); freopen("s.out","w",stdout); cin>>n>>x; for(i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); cout<<tknp(x); }