2012-11-13から1日間の記事一覧

AOJ 10027 - Card Game

aoj

文字列の比較は"a"と"abc"ならばaが先(短いほうが先?)になるらしい. main(){ int n, ap=0, bp=0; char a[110], b[110]; scanf("%d", &n); for(;n--;){ scanf("%s", a); scanf("%s", b); int comp = strcmp(a, b); if(comp > 0){ ap += 3; }else if(comp ==…

AOJ 10026 - Standard Deviation

aoj

はm(平均)がわからないと計算できない. 平均をもとめるには全得点がわからないといけない. そうすると,すべての点を配列として保持しないといけない. それはめんどうなので,を利用した. #include<math.h> main(){ int n, i, s; double a, b, c, m, alpha_s; wh</math.h>…

AOJ 10025 - Triangle, math.hをincludeするとき

aoj

math.hをincludeするときは-lmオプションをつける #include <math.h> main(){ double a, b, C; scanf("%lf %lf %lf", &a, &b, &C); double rad = C*M_PI/180, S = a*b*sin(rad)/2, h = b*sin(rad), ar = a+b+sqrt(a*a+b*b-2*a*b*cos(rad)); printf("%lf\n%lf\n%lf\n"</math.h>…