Submission #450420

#TimeUsernameProblemLanguageResultExecution timeMemory
450420rainboyTuna (COCI17_tuna)C11
50 / 50
1 ms272 KiB
#include <stdio.h>

int abs_(int a) { return a > 0 ? a : -a; }
int max(int a, int b) { return a > b ? a : b; }

int main() {
	int n, x, ans;

	scanf("%d%d", &n, &x);
	ans = 0;
	while (n--) {
		int a, b;

		scanf("%d%d", &a, &b);
		if (abs_(a - b) <= x)
			ans += max(a, b);
		else {
			scanf("%d", &a);
			ans += a;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message (stderr)

tuna.c: In function 'main':
tuna.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d%d", &n, &x);
      |  ^~~~~~~~~~~~~~~~~~~~~
tuna.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d%d", &a, &b);
      |   ^~~~~~~~~~~~~~~~~~~~~
tuna.c:18:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |    scanf("%d", &a);
      |    ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...