Login
Immutable PageDiscussionInfoAttachments

Revision 22 as of 2012-05-22 17:40:46

Clear message
rei05/C言語

MMA

C言語

AOJ解答

Help Me!

未解決

#include<stdio.h>
#include<math.h>
int main(){

int n,s[1000],i,m1,m2;
double a;

while(1){
  m1=0;m2=0;
  scanf("%d",&n); if(n==0) break;
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
    m1+=s[i];
  }
  for(i=0;i<n;i++){
    m2+=pow(s[i]-m1/n,2);
  }
  a=fabs(sqrt(m2/n));
  printf("%f\n",a);
}

return(0);
}