結果

問題 No.545 ママの大事な二人の子供
ユーザー tailstails
提出日時 2017-07-14 23:55:53
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 255 bytes
コンパイル時間 1,464 ms
コンパイル使用メモリ 28,416 KB
実行使用メモリ 33,792 KB
最終ジャッジ日時 2024-04-16 20:48:03
合計ジャッジ時間 4,390 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,656 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 18 ms
5,376 KB
testcase_19 AC 69 ms
5,376 KB
testcase_20 AC 274 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | n;A[32];B[32];
      | ^
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;A[32];B[32];
      |   ^
main.c:1:3: warning: type defaults to 'int' in declaration of 'A' [-Wimplicit-int]
main.c:1:9: warning: data definition has no type or storage class
    1 | n;A[32];B[32];
      |         ^
main.c:1:9: warning: type defaults to 'int' in declaration of 'B' [-Wimplicit-int]
main.c:4:1: warning: return type defaults to 'int' [-Wimplicit-int]
    4 | f(i,a)long long a;{
      | ^
main.c: In function 'f':
main.c:4:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:6:22: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    6 |                 if(b>abs(a)){
      |                      ^~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
  +++ |+#include <stdlib.h>
    1 | n;A[32];B[32];
main.c:6:26: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
    6 |                 if(b>abs(a)){
      |                          ^
<built-in>: note: built-in 'abs' declared here
main.c:7:31: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
    7 |                         b=abs(a);
      |                               ^
<built-in>: note: built-in 'abs' declared here
main.c: At top level:
main.c:15:1: warning: return type defaults to 'int' [-Wimplicit-int]
   15 | main(){
      | ^~~~
main.c: In function 'main':
main.c:16:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   16 |         scanf("%d",&n);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a 

ソースコード

diff #

n;A[32];B[32];
long long b=1ll<<60;

f(i,a)long long a;{
	if(i==n){
		if(b>abs(a)){
			b=abs(a);
		}
	}else{
		f(i+1,a+A[i]);
		f(i+1,a-B[i]);
	}
}

main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i){
		scanf("%d%d",A+i,B+i);
	}
	f(0,0);
	printf("%lld",b);
}
0