Submission #480029

#TimeUsernameProblemLanguageResultExecution timeMemory
480029rainboyTrol (COCI19_trol)C11
50 / 50
1 ms204 KiB
#include <stdio.h>

long long sum(long long n) {
	return (n / 9) * 45 + (n % 9) * (n % 9 + 1) / 2;
}

int main() {
	int q;

	scanf("%d", &q);
	while (q--) {
		long long l, r;

		scanf("%lld%lld", &l, &r);
		printf("%lld\n", sum(r) - sum(l - 1));
	}
	return 0;
}

Compilation message (stderr)

trol.c: In function 'main':
trol.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d", &q);
      |  ^~~~~~~~~~~~~~~
trol.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%lld%lld", &l, &r);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...