Submission #482867

# Submission time Handle Problem Language Result Execution time Memory
482867 2021-10-26T16:00:25 Z rainboy Euklid (COCI20_euklid) C
4 / 110
1 ms 204 KB
#include <stdio.h>

int main() {
	int t;

	scanf("%d", &t);
	while (t--) {
		int a, b;
		long long l, r;

		scanf("%d%d", &a, &b);
		l = b, r = b + b - 1;
		while (1) {
			long long x = r / a * a;

			if (x >= l) {
				printf("%lld %lld\n", x, x * b + a);
				break;
			}
			l *= b, r = (r + 1) * b - 1;
		}
	}
	return 0;
}

Compilation message

euklid.c: In function 'main':
euklid.c:6:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d", &t);
      |  ^~~~~~~~~~~~~~~
euklid.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d%d", &a, &b);
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -