Login
Immutable PageDiscussionInfoAttachments
Diff for "rei05/C言語"

MMA
Differences between revisions 20 and 21
Revision 20 as of 2012-05-22 16:34:05
Size: 1113
Editor: rei05
Comment:
Revision 21 as of 2012-05-22 17:19:31
Size: 1081
Editor: rei05
Comment:
Deletions are marked like this. Additions are marked like this.
Line 38: Line 38:
    m2+=pow(s[i]-(double)m1/(double)n,2);     m2+=pow(s[i]-m1/n,2);
Line 40: Line 40:
  a=fabs(sqrt((double)m2/(double)n));   a=fabs(sqrt(m2/n));

C言語

AOJ解答

  • 最終的にAcceptedとなった回答です。
  • ここはこうした方がいいなど改善すべき点がありましたら是非ご教授お願いします。
  • 10020

  • 10021

  • 10022

  • 10023

  • 10024

  • 10025

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);
}

rei05/C言語 (last edited 2012-07-16 17:50:37 by nomeaning)