[Zhengqing] [1802] SC Borrows Water

Problem Description

Loading...

Problem Analysis

It’s mainly just about thinking it through…
This kind of thing is fine once you figure it out…
Though it seems I also got WA several times…

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
int main() {
	int T,V,K,S,E,sum;
	int i;
	while(~scanf("%d",&T)) {
		while(T--) {
			scanf("%d %d %d %d",&V,&K,&S,&E);
			S=(S-1)/K;
			E=E/K;
			sum=E-S;
			if(sum>V)
				printf("%d\n",V);
			else
				printf("%d\n",sum);
		}
	}
	return 0;
}

Problem link: [ZZULI][1802]SC Borrows Water

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...