322

yxc

//这里填你的代码^^
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 100010;
int num[N];
int main()
{
int n;
cin >> n;
int maxv = 0, minv = 111111;
int temp, a1, a2;
while (cin >> temp)
{
if (temp > maxv)maxv = temp;
if (temp < minv)minv = temp;
num[temp]++;
}
for (int i = minv; i <= maxv; i++)
{
if (num[i] == 0)a1 = i;
if (num[i] == 2)a2 = i;
}
cout << a1 << ' ' << a2 << endl;
return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
int res = 0;
for (int i = 1; i <= n; i++)
{
int x = i;
while (x)
{
int t = x %10;
x /= 10;
if (t == 2 || t == 0 || t == 1 || t == 9)
{
res+=i;
break;
}
}
}
cout << res << endl;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int N = 100010;
int n;
int a[N], b[N], c[N];
int as[N];//as[i]表示在A[]中有多少个数小于b[i]
int cs[N];//cs[i]表示在A[]中有多少个数大于b[i]
int cnt[N], s[N];
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; i++)scanf("%d", a + i),a[i]++;
for (int i = 0; i < n; i++)scanf("%d", b + i),b[i]++;
for (int i = 0; i < n; i++)scanf("%d", c + i),c[i]++;

//求as[]
for (int i = 0; i < n; i++)cnt[a[i]]++;
for (int i = 1; i < N; i++)s[i] = s[i - 1] + cnt[i];
for (int i = 0; i < n; i++)as[i] = s[b[i] - 1];

//求cs[]
memset(cnt, 0, sizeof(cnt));
memset(s, 0, sizeof(s));
for (int i = 0; i < n; i++)cnt[c[i]]++;
for (int i = 1; i < N; i++)s[i] = s[i - 1] + cnt[i];
for (int i = 0; i < n; i++)cs[i] =s[N-1]-s[b[i]];
long long res = 0;
for (int i = 0; i < n; i++)
{
res += (long long)as[i] * cs[i];
}
cout << res << endl;
return 0;
}


y总怎会如此优秀QAQ

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
const int N = 10010;
int n;
int a[N];
int main()
{
cin >> n;
for (int i = 0; i < n; i++)cin >> a[i];
int res = 0;
for (int i = 0; i < n; i++)//枚举区间左端点
{
int minv = n+1, maxv = 0;
for (int j = i; j < n; j++)
{
minv = min(minv, a[j]);
maxv = max(maxv, a[j]);
if (maxv - minv == j - i)res++;
}
}
cout << res << endl;
return 0;
}


y总太强啦！

#include<iostream>
#include<vector>
#include<string>
using namespace std;
bool cmp(vector<int>&A,vector<int>&B)
{
if(A.size()!=B.size())return A.size()>B.size();
for(int i=A.size()-1;i>=0;i--)
{
if(A[i]!=B[i])return A[i]>B[i];
}
return true;
}
vector<int> sub(vector<int>&A,vector<int>&B)
{
vector<int> C;
for(int i=0,t=0;i<A.size();i++)
{
t=A[i]-t;
if(i<B.size())t-=B[i];
C.push_back((t+10)%10);
if(t<0)t=1;
else t=0;
}
while(C.size()>1&&C.back()==0)C.pop_back();
return C;
}
int main()
{
string a,b;
cin>>a>>b;
vector<int>A,B;
for(int i=a.size()-1;i>=0;i--)A.push_back(a[i]-'0');
for(int i=b.size()-1;i>=0;i--)B.push_back(b[i]-'0');
if(cmp(A,B))
{
auto C=sub(A,B);
for(int i=C.size()-1;i>=0;i--)printf("%d",C[i]);
}
else
{
auto C=sub(B,A);
printf("-");
for(int i=C.size()-1;i>=0;i--)printf("%d",C[i]);
}
return 0;
}



/小菜鸟现在只会全程跟着y总写/

#include<iostream>
#include<vector>
#include<string>
using namespace std;
{
vector<int>C;
int t=0;
for(int i=0;i<A.size()||i<B.size();i++)
{
if(i<A.size())t+=A[i];
if(i<B.size())t+=B[i];
C.push_back(t%10);
t/=10;
}
if(t)C.push_back(1);
return C;
}
int main()
{
string a,b;
vector<int>A,B;
cin>>a>>b;
for(int i=a.size()-1;i>=0;i--)A.push_back(a[i]-'0');
for(int i=b.size()-1;i>=0;i--)B.push_back(b[i]-'0');
for(int i=C.size()-1;i>=0;i--)printf("%d",C[i]);
return 0;
}


#include<iostream>
using namespace std;
int main()
{
int p,q;
cin>>p>>q;
cout<<(p-1)*(q-1)-1<<endl;
return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;
double n,l,r,mid;
double q(double a)
{
return a*a*a;
}
int main()
{
cin>>n;
l=-10000;
r=10000;
while((r-l)>1e-7)
{
mid=(l+r)/2;
if(q(mid)>=n)r=mid;
else l=mid;
}
cout<<fixed<<setprecision(6)<<l;
return 0;
}//跟着大佬学习


#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
int a[N];
int n,k;
void quick_sort(int a[],int l,int r)
{
if(l>=r)return;
int x=a[(l+r)/2],i=l-1,j=r+1;
while(i<j)
{
do i++; while(a[i]<x);
do j--;while(a[j]>x);
if(i<j) swap(a[i],a[j]);
}
quick_sort(a,l,j);
quick_sort(a,j+1,r);
}
int main()
{
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)scanf("%d",a+i);
quick_sort(a,1,n);
printf("%d",a[k]);
}