[Zhengqing] [1769] Journey to the Teachers College: How to Get There (III)

Problem Description

Loading...

Problem Analysis

A stair-step problem
A bit of an IQ test…
Just work it out yourself~

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <stdio.h>
int main() {
	int n,a,b;
	scanf("%d",&n);
	while(n--) {
		scanf("%d %d",&a,&b);
		a-=1;
			if(a%b==0)
				printf("%d\n",a/b);
			else
				printf("%d\n",a/b+1);
		}
	return 0;
}

By the way… after writing it out, the code feels so simple…
A lot of problems are like this
The main thing is understanding the problem
Then once you have the idea
After finishing the code
You get that sudden feeling of clarity

Problem link: [ZZULI][1796] The Journey to the Teachers College: How Can We Go (III)

Loading...