提出 #1431076


ソースコード 拡げる

#include <stdio.h>

long long int abs(long long int a){
	if(a < 0)
		return -a;
	else
		return a;
}

int main(){
	long long int N;
	long long int a[2*10*10*10*10*10*10];
	long long int result = 100000000000;
	long long int total_count = 0;
	long long int count = 0;

	scanf("%lld", &N);

	long long int i, j;
	for(i = 0; i < N; i++){
		scanf("%lld", &a[i]);
		total_count += a[i];
	}

	for(i = 0; i < N-1; i++){
		count += a[i];
		if(abs(total_count - 2*count) < result)
			result = abs(total_count - 2*count);
	}

	printf("%lld\n", result);

	return 0;
}

提出情報

提出日時
問題 C - Splitting Pile
ユーザ ponntuu3
言語 C (GCC 5.4.1)
得点 300
コード長 588 Byte
結果 AC
実行時間 24 ms
メモリ 3712 KiB

コンパイルエラー

./Main.c:3:15: warning: conflicting types for built-in function ‘abs’
 long long int abs(long long int a){
               ^
./Main.c: In function ‘main’:
./Main.c:17:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &N);
  ^
./Main.c:21:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a[i]);
   ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 16
セット名 テストケース
Sample 00_example_01.txt, 00_example_02.txt
All 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt
ケース名 結果 実行時間 メモリ
00_example_01.txt AC 1 ms 128 KiB
00_example_02.txt AC 1 ms 128 KiB
01.txt AC 12 ms 896 KiB
02.txt AC 5 ms 384 KiB
03.txt AC 4 ms 384 KiB
04.txt AC 15 ms 2432 KiB
05.txt AC 4 ms 384 KiB
06.txt AC 24 ms 3712 KiB
07.txt AC 23 ms 2304 KiB
08.txt AC 24 ms 3200 KiB
09.txt AC 23 ms 3456 KiB
10.txt AC 23 ms 2432 KiB
11.txt AC 1 ms 128 KiB
12.txt AC 1 ms 128 KiB
13.txt AC 21 ms 2944 KiB
14.txt AC 1 ms 128 KiB