結果
問題 | No.461 三角形はいくつ? |
ユーザー |
![]() |
提出日時 | 2016-12-12 01:19:11 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 968 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-29 04:48:13 |
合計ジャッジ時間 | 2,573 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 WA * 32 |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | n;c[3]; | ^ main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | n;c[3]; | ^ main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int] main.c:3:1: warning: data definition has no type or storage class 3 | i;j;k;p; | ^ main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int] main.c:3:3: warning: data definition has no type or storage class 3 | i;j;k;p; | ^ main.c:3:3: warning: type defaults to ‘int’ in declaration of ‘j’ [-Wimplicit-int] main.c:3:5: warning: data definition has no type or storage class 3 | i;j;k;p; | ^ main.c:3:5: warning: type defaults to ‘int’ in declaration of ‘k’ [-Wimplicit-int] main.c:3:7: warning: data definition has no type or storage class 3 | i;j;k;p; | ^ main.c:3:7: warning: type defaults to ‘int’ in declaration of ‘p’ [-Wimplicit-int] main.c:4:1: warning: data definition has no type or storage class 4 | r; | ^ main.c:4:1: warning: type defaults to ‘int’ in declaration of ‘r’ [-Wimplicit-int] main.c:17:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 17 | main(){ | ^~~~ main.c: In function ‘main’: main.c:18:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 18 | scanf("%d",&n); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | n;c[3]; main.c:18:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 18 | scanf("%d",&n); | ^~~~~ main.c:18:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:46:9: warning: implicit de
ソースコード
n;c[3];double d[3][5000],a,b;i;j;k;p;r;double e=5e-11;int dblcmp(void*a,void*b){if(*(double*)a<*(double*)b){return -1;}if(*(double*)a>*(double*)b){return 1;}return 0;}main(){scanf("%d",&n);r=n+1;for(i=0;i<n;++i){scanf("%d%lf%lf",&p,&a,&b);d[p][c[p]++]=a/(a+b);}for(i=0;i<c[0];++i){for(j=0;j<c[1];++j){if(d[0][i]+d[1][j]>1+e){++r;}}}for(i=0;i<c[0];++i){for(j=0;j<c[2];++j){if(d[0][i]+d[2][j]>1+e){++r;}}}for(i=0;i<c[1];++i){for(j=0;j<c[2];++j){if(d[1][i]+d[2][j]>1+e){++r;}}}qsort(d[1],c[1],sizeof(double),dblcmp);qsort(d[2],c[2],sizeof(double),dblcmp);for(i=0;i<c[0];++i){double d0=d[0][i];j=0;k=c[2]-1;while(j<c[1] && k>=0){double d1=d[1][j];double d2=d[2][k];if(d0+d1>1-e && d0+d2>1-e && d1+d2>1-e && fabs(d0+d1+d2-2)>e){r+=j+1;}if(d1+d2<1){++j;}else{--k;}}}printf("%d",r);return 0;}