|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
10
2.345 8.605 2.876 0.919 4.455 7.289 7.390 6.276 1.298 7.773
3
#include<stdio.h>
FILE *fr,*fw;
void kai();
void guan();
void kai()
{
fr=fopen("20161203c22.in","r");
fw=fopen("20161203c22.out","w");
}
void guan()
{
fclose(fr);
fclose(fw);
}
main()
{
kai();
float s[100],b[100];
long i,n,x,a[100],c[100],d[100],f[100],m;
fscanf(fr,"%d",&n);
for(i=1;i<=n;++i)
fscanf(fr,"%f",&s[i]);
fscanf(fr,"%d",&x);
for(i=1;i<=n;++i)
{
b[i]=(int)s[i];
a[i]=s[i]-b[i];
}
m=0;
for(i=1;i<=n;++i)
{
a[i]=a[i]*10;
c[i]=(int)a[i];
if(c[i]==x){++m;f[m]=i;}
}
for(i=1;i<=m;++i)
if(m==0) fprintf(fw,"-1");
else fprintf(fw,"%5d",f[i]);
guan();
} |
|