답안 #480029

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
480029 2021-10-14T11:49:43 Z rainboy Trol (COCI19_trol) C
50 / 50
1 ms 204 KB
#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

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);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct