跳到正文

题解

CF1571B 题解

ikunTLE约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年8月2日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟
获赞
6
题目
CF1571B

版本

  1. v1当前

题目传送门

思路

本题需要根据 Alex 读书开始的时间确定答案,需要分类讨论:

  • 若 vc−vc>b−av_c-v_c>b-a,则 Alex 在第 aa 天开始读小说,再读第 vc+b−av_c+b-a 章。

  • 否则说明 Alex 一直在读第 vcv_c 章。

CODE

C
#include<stdio.h>
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
int main(){
	int t=read();
	while(t--){
		int n=read(),a=read(),va=read(),c=read(),vc=read(),b=read();
		printf("%d\n",(b-a>vc-va)?(va+b-a):vc);
	}
	return 0;
}
原文