NO.1
代码实现:
#include #include using namespace std; typedef long long ll; int main() { ll x; cin>>x; ll a=sqrt(x); ll x1=a*a,x2=(a+1)*(a+1); if(x-x1 int g=0; for(auto& [a,b]:cnt) { g+=b/x+(b%x==0?0:1); } return g cinnm; int hmax=0; for(int i=0;i int x; cinx; hmax=max(hmax,++cnt[x]); } int kinds=cnt.size(); if(kindsm) cout for(int i=1;i if(check(i)) { cout int g=0; for(auto& [a,b]:cnt) { g+=b/x+(b%x==0?0:1); } return g cinnm; int hmax=0; for(int i=0;i int x; cinx; hmax=max(hmax,++cnt[x]); } int kinds=cnt.size(); if(kindsm) cout int l=1,r=hmax; while(l int mid=(l+r)/2; if(check(mid)) r=mid; else l=mid+1; } cout cin n m; while (m--) { int a, b; cin a b; edges[a].push_back(b); // 存储边的信息 in[b]++; // 存储⼊度 } for (int i = 1; i if (in[i] == 0) { q.push(i); } } while (q.size()) { int a = q.front(); q.pop(); ret.push_back(a); for (auto b : edges[a]) { if (--in[b] == 0) { q.push(b); } } } // 判断 if (ret.size() == n) { for (int i = 0; i
文章版权声明:除非注明,否则均为VPS857原创文章,转载或复制请以超链接形式并注明出处。
还没有评论,来说两句吧...