//a
#include <iostream>
using namespace std;
int main()
{int x1,y1,x2,y2,x3,y3,x4,y4;
cin>>x1>>y1;
cin>>x2>>y2;
cin>>x3>>y3;
cin>>x4>>y4;
int x20=max(x1,x2);
int x10=min(x1,x2);
int x40=max(x3,x4);
int x30=min(x3,x4);
int v=min(x20,x40)-max(x30,x10);
if (v>=0)cout << v << endl; else cout<<-1;
return 0;
}
|
//d
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main()
{
char *n=new char[200000000];
cin>>n;
for(int i=0;i<strlen(n)-1;i++)
for(int j=0;j<strlen(n)-1;j++)
if(n[j]>n[j+1])swap(n[j],n[j+1]);
int k=0;
while(n[k]=='0')k++;
swap(n[0],n[k]);
cout << n << " ";
for(int i=0;i<strlen(n)-1;i++)
for(int j=0;j<strlen(n)-1;j++)
if(n[j]<n[j+1])swap(n[j],n[j+1]);
cout << n << endl;
return 0;
}
|
//b
#include <iostream>
using namespace std;
int main()
{long long int n,m,temp;
int k=0;
cin>>n>>m;
for(int i=n;i<=m;i++)
{
temp=i;
while (temp%2==0) temp=temp/2;
while (temp%3==0) temp=temp/3;
while (temp%5==0) temp=temp/5;
if (temp==1) k++;
}
cout << k << endl;
return 0;
}
|
//e
#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main()
{
char *n=new char[200000000];
cin>>n;
for(int j=0;j<strlen(n);j++)
if(n[j]>='0'&&n[j]<='9')cout<<n[j];
cout << endl;
return 0;
}
|
//c
#include <iostream>
using namespace std;
int main()
{long long int n,minn;
int a[100000];
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
minn=2000;
for(int i=1;i<=n;i++)
if(a[i]<minn && a[i]>0) minn=a[i];
if(minn==2000) cout << 0 << endl; else cout << minn << endl;
return 0;
}
|
//f
#include <iostream>
using namespace std;
int main()
{long long int n,k,f,a,b,black,white;
int r[10000];
cin>>n;
for(int i=1;i<=n;i++){
cin>>k;
white=0;black=0;
for(int j=1;j<=k;j++)
{
cin>>a>>b;
if ((a%2==0 && b%2==0 )|| (a%2==1 && b%2==1 )) black++; else white++;
}
if (white==k || black==k)r[i]=1;else r[i]=0;
}
for(int i=1;i<=n;i++)cout<<r[i];
cout << endl;
return 0;
}
|