huangzirui @ 2017-03-13 21:50:19
#include<algorithm>
int main()
{int a[11],b[11],s;
for(int i=0;i<10;i++)
scanf("%d",&a[i]);
scanf("%d",&s);
s+=30;
std::sort(a,a+10);
for(int i=0;i<10;i++)
if(s>=a[i])b[i]=1;
for(int i=0;i<10;i++)
if(b[i]!=1){printf("%d",i);
}printf("10");
return 0;
```}
### **90分**怎么办《'\_'》
by huangzirui @ 2017-03-13 21:52:22
90?
#include<stdio.h>
include<algorithm>
int main() {
int a[11],b[11],s;
for(int i=0;i<10;i++)
scanf("%d",&a[i]);
scanf("%d",&s);
s+=30;
std::sort(a,a+10);
for(int i=0;i<10;i++)
if(s>=a[i])b[i]=1; for(int i=0;i<10;i++)
if(b[i]!=1){printf("%d",i); }printf("10"); return 0;
```}
90分怎么办《'\_'》
by huangzirui @ 2017-03-13 21:53:20
改正:加个“#”
by 早起的小金乌 @ 2017-03-26 18:37:46
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int a[20],n,ans=0;
for(int i=0;i<10;i++)
cin>>a[i];
cin>>n;
n+=30;
for(int i=0;i<10;i++)
if(a[i]<=n)
ans++;
cout<<ans<<endl;
return 0;
}
by tb2016 @ 2017-04-05 21:34:53
b数组有问题,你判断(s >= a[i])时给b数组赋值1,但不满足条件的时候b数组无值
by tb2016 @ 2017-04-05 21:44:22
@tb2016 其实不止b数组的问题,你的头文件,还有printf输出都有问题,思路有些绕弯弯
建议:先sort一下你的a数组,然后count计数满足s>=a[i]条件的数,输出count即可!
by yzxbt @ 2017-05-06 23:28:26
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv)
{
int i,a[15]={},s,n;
s=0;
for(i=1;i<=10;i++)
cin>>a[i];
cin>>n;
n+=30;
for(i=1;i<=10;i++)
if(a[i]<=n)
s++;
cout<<s<<endl;
return 0;
}