結果

問題 No.545 ママの大事な二人の子供
ユーザー tails
提出日時 2017-07-14 23:55:53
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 255 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 28,288 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-10-08 00:09:35
合計ジャッジ時間 4,584 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 TLE * 1 -- * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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