Submission #482869

#TimeUsernameProblemLanguageResultExecution timeMemory
482869rainboyEuklid (COCI20_euklid)C11
110 / 110
1 ms332 KiB
#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 && a < x) {
				printf("%lld %lld\n", x, x * b + a);
				break;
			}
			l *= b, r = (r + 1) * b - 1;
		}
	}
	return 0;
}

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...