include[HTML_REMOVED]
using namespace std;
int n;
struct node{
int y[4];
int len;
long long s=0,e;
}CIDR[1000006];
void ScanF();
void Merge1();
void countSE(node &a);
void Merge2();
bool cmp(node a,node b){
for(int i=0;i<=3;i){
if(a.y[i]==b.y[i])continue;
return a.y[i][HTML_REMOVED]v1,v2;
long long s1=a.s,s2=b.s;
while(s1){
v1.push_back(s1%2);
s1/=2;
}
while(v1.size()<32){
v1.push_back(0);
}
while(s2){
v2.push_back(s2%2);
s2/=2;
}
while(v2.size()<32){
v2.push_back(0);
}
reverse(v1.begin(),v1.end());
reverse(v2.begin(),v2.end());
for(int i=0;i[HTML_REMOVED]v;
stack[HTML_REMOVED]mmp;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);Pow[0]=1;
PPow[0]=1;
for(int i=1;i<=32;i){
Pow[i]=Pow[i-1]*2;
PPow[i]=Pow[i]+PPow[i-1];
}
ScanF();
sort(CIDR+1,CIDR+n+1,cmp);
for(int i=1;i<=n;i){
countSE(CIDR[i]);
}
Merge1();
Merge2();
stack[HTML_REMOVED]mmp2;
while(!mmp.empty()){
mmp2.push(mmp.top());
mmp.pop();
}
while(!mmp2.empty()){
node now=mmp2.top();
mmp2.pop();
cout<<now.y[0]<<”.”<<now.y[1]<<”.”<<now.y[2]<<”.”<<now.y[3]<<”/”<<now.len<<endl;
}
}
void Merge2(){
for(int i=0;i<v.size();i){
if(mmp.empty()){
mmp.push(v[i]);
}else if(mmp.top().len!=v[i].len){
mmp.push(v[i]);
}else{
node now=v[i];
while(!mmp.empty()&&mmp.top().len==now.len&&fun(mmp.top(),now)){
now=mmp.top();
now.len–;
countSE(now);
mmp.pop();
}
mmp.push(now);
}
}
}
void Merge1(){
int num=2,Last=1;
v.push_back(CIDR[1]);
while(num<=n){
if(CIDR[num].e<=CIDR[Last].e&&CIDR[num].s>=CIDR[Last].s)num;
else{
Last=num;
v.push_back(CIDR[num]);
num;
}
}
}
void countSE(node &a){
int cnt1=a.len/8;
if(a.len%8)cnt1;
a.s=0;
for(int j=0;j[HTML_REMOVED]>n;
for(int i=1;i<=n;i){
cin>>str;
flag1=false;
ans=0;
cnt1=0;
flag2=0;
int cnt2=0;
for(int j=0;j[HTML_REMOVED]=‘0’){
flag2=1;
cnt1=cnt110+str[j]-‘0’;
}else if(str[j]==’/’){
if(flag2){
flag2=0;
CIDR[i].y[cnt2]=cnt1;
cnt1=0;
}
flag1=true;
}else if(str[j]==’.’){
ans;
if(flag2){
flag2=0;
CIDR[i].y[cnt2]=cnt1;
cnt1=0;
}
}
}
if(flag1){
for(int j=cnt2;j<=3;j){
CIDR[i].y[j]=0;
}
CIDR[i].len=cnt1;
}else{
for(int j=cnt2;j<=3;j++){
CIDR[i].y[j]=cnt1;
cnt1=0;
}
CIDR[i].len=(ans+1)8;
}
}
}
//第一次做人,不要批评,我只是为了记录一下考研的历程,以后回忆。
对呢
现在大三吗
这个模拟题繁琐啊