初级光能
为嘛错????
分割数组(array)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
int n,x,a[100010]; int cnt;
int main()
{
freopen("array.in","r",stdin);
freopen("array.out","w",stdout);
cin>>n>>x;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i++]<=x)
{
cnt++;
}
}
cout<<cnt;
fclose(stdin);
fclose(stdout);
return 0;
}
数列排序(sort)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
int s,n,a[30010],b[30010]={0},x;
int main()
{
freopen("sort.in","r",stdin);
freopen("sort.out","w",stdout);
cin>>n>>x;
for(int i=1;i<=n;i++)
cin>>a[i];
sort(a+1,a+1+n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<i;j++)
if(a[i]==a[j]) b[i]=1;
}
for(int i=1;i<=n;i++)
{
if(b[i]==0)
{
s=a[x];
cout<<s+1;
break;
}
else
{
cout<<"NO RESULT";
}
}
fclose(stdin);
fclose(stdout);
return 0;
}
初级光能
............................今晚我不考,我跟我妈说了...............................