Ref: ITSA 53 - [Problem 2] 洞穴裡的人
/*******************************************************/
/* ITSA 53 - [Problem 2] 洞穴裡的人 */
/* Author: awei0905 [at] awei0905.blogspot.tw */
/* Version: 2017/04/09 */
/*******************************************************/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main() {
int n;
int N, M;
scanf("%d", &n);
while (n-- ) {
scanf("%d%d", &N, &M);
while ((N/=4) >= M) N += M;
printf("%d\n", N);
}
}
Debug: I/O4
330
4
12
10
12
15
333
7
2
3
3
3
沒有留言:
張貼留言