結果

問題 No.398 ハーフパイプ(2)
ユーザー 👑 testestesttestestest
提出日時 2016-07-18 02:41:47
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 14:43:28
合計ジャッジ時間 884 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,248 KB
testcase_01 AC 7 ms
5,376 KB
testcase_02 AC 7 ms
5,376 KB
testcase_03 AC 6 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 6 ms
5,376 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 6 ms
5,376 KB
testcase_08 AC 7 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 6 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 7 ms
5,376 KB
testcase_14 AC 6 ms
5,376 KB
testcase_15 AC 6 ms
5,376 KB
testcase_16 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | coe[8][4]={
      | ^~~
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘coe’ [-Wimplicit-int]
main.c:11:8: warning: data definition has no type or storage class
   11 | long a;i1,i2,i3,i4,f;
      |        ^~
main.c:11:8: warning: type defaults to ‘int’ in declaration of ‘i1’ [-Wimplicit-int]
main.c:11:11: warning: type defaults to ‘int’ in declaration of ‘i2’ [-Wimplicit-int]
   11 | long a;i1,i2,i3,i4,f;
      |           ^~
main.c:11:14: warning: type defaults to ‘int’ in declaration of ‘i3’ [-Wimplicit-int]
   11 | long a;i1,i2,i3,i4,f;
      |              ^~
main.c:11:17: warning: type defaults to ‘int’ in declaration of ‘i4’ [-Wimplicit-int]
   11 | long a;i1,i2,i3,i4,f;
      |                 ^~
main.c:11:20: warning: type defaults to ‘int’ in declaration of ‘f’ [-Wimplicit-int]
   11 | long a;i1,i2,i3,i4,f;
      |                    ^
main.c:12:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   12 | main(S){
      | ^~~~
main.c: In function ‘main’:
main.c:12:1: warning: type of ‘S’ defaults to ‘int’ [-Wimplicit-int]
main.c:13:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   13 |         scanf("%d.%d",&i1,&i2);S=i1*4+i2/25;
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | coe[8][4]={
main.c:13:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   13 |         scanf("%d.%d",&i1,&i2);S=i1*4+i2/25;
      |         ^~~~~
main.c:13:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:21:12: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   21 |         a=!printf("%ld",a);
      |            ^~~~~~
main.c:21:12: note: include ‘<stdio.h>’

ソースコード

diff #

coe[8][4]={
{720,360,360,180},//-bcde-
{360,180,120,60},//-bcdd-
{360,180,180,90},//-bccd-
{120,60,30,15},//-bccc-
{360,120,180,60},//-bbcd-
{180,60,60,20},//-bbcc-
{120,30,60,15},//-bbbc-
{30,6,6,1}//-bbbb-
};
long a;i1,i2,i3,i4,f;
main(S){
	scanf("%d.%d",&i1,&i2);S=i1*4+i2/25;
	for(i1=0;i1<=100;i1++)for(i2=i1;i2<=100;i2++)for(i3=i2;i3<=100;i3++)for(i4=i3;i4<=100;i4++)if(i1+i2+i3+i4==S){
		f=(i1==i2)*4|(i2==i3)*2|i3==i4;
		a+=coe[f][0]*i1*(100-i4);	//端はタブらないやつ
		a+=coe[f][1]*(100-i4);	//左端だけダブルやつ
		a+=coe[f][2]*i1;	//右端だけダブルやつ
		a+=coe[f][3];	//両方ダブルやつ
	}
	a=!printf("%ld",a);
}
0