Codeforces Round #392 (Div. 2)C. Unfair Poll

ubuntu18.04安装R——无法连接上 dl.google.com:80 (6.6.6.6),连接超时&&E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。 安装R的时候,sudo apt update 的时候出现错误: 查资料要修改/etc/apt/sources.list.d/google-chrome.list 文件 原来是: deb http://dl.google.com/linux/chrome/deb/ stable main 改为: deb [arch=amd64] http://dl.google.com/linux/chrom... 阅读详情

C. Unfair Poll
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others.

Seating in the class looks like a rectangle, where n rows with m pupils in each.

The teacher asks pupils in the following order: at first, she asks all pupils from the first row in the order of their seating, then she continues to ask pupils from the next row. If the teacher asked the last row, then the direction of the poll changes, it means that she asks the previous row. The order of asking the rows looks as follows: the 1-st row, the 2-nd row, ..., the n - 1-st row, the n-th row, the n - 1-st row, ..., the 2-nd row, the 1-st row, the 2-nd row, ...

The order of asking of pupils on the same row is always the same: the 1-st pupil, the 2-nd pupil, ..., the m-th pupil.

During the lesson the teacher managed to ask exactly k questions from pupils in order described above. Sergei seats on the x-th row, on the y-th place in the row. Sergei decided to prove to the teacher that pupils are asked irregularly, help him count three values:

  1. the maximum number of questions a particular pupil is asked,
  2. the minimum number of questions a particular pupil is asked,
  3. how many times the teacher asked Sergei.

If there is only one row in the class, then the teacher always asks children from this row.

Input

The first and the only line contains five integers n, m, k, x and y (1 ≤ n, m ≤ 100, 1 ≤ k ≤ 1018, 1 ≤ x ≤ n, 1 ≤ y ≤ m).

Output

Print three integers:

  1. the maximum number of questions a particular pupil is asked,
  2. the minimum number of questions a particular pupil is asked,
  3. how many times the teacher asked Sergei.
Examples
input
1 3 8 1 1
output
3 2 3
input
4 2 9 4 2
output
2 1 1
input
5 5 25 4 3
output
1 1 1
input
100 100 1000000000000000000 100 100
output
101010101010101 50505050505051 50505050505051
Note

The order of asking pupils in the first test:

  1. the pupil from the first row who seats at the first table, it means it is Sergei;
  2. the pupil from the first row who seats at the second table;
  3. the pupil from the first row who seats at the third table;
  4. the pupil from the first row who seats at the first table, it means it is Sergei;
  5. the pupil from the first row who seats at the second table;
  6. the pupil from the first row who seats at the third table;
  7. the pupil from the first row who seats at the first table, it means it is Sergei;
  8. the pupil from the first row who seats at the second table;

The order of asking pupils in the second test:

  1. the pupil from the first row who seats at the first table;
  2. the pupil from the first row who seats at the second table;
  3. the pupil from the second row who seats at the first table;
  4. the pupil from the second row who seats at the second table;
  5. the pupil from the third row who seats at the first table;
  6. the pupil from the third row who seats at the second table;
  7. the pupil from the fourth row who seats at the first table;
  8. the pupil from the fourth row who seats at the second table, it means it is Sergei;
  9. the pupil from the third row who seats at the first table;

找规律,纯公式计算感觉太麻烦,对于重复部分计算,多出来的那一小部分开个数组模拟一下就行了

举个例子

n=4时

1 2 3 4 3 2 1 2 3 4 3 2 

所以重复的部分就是1 2 3 4 3 2 

1 2 ..n-1 n n-1 ...2

2*n-2行,其中每重复一次,第1行和第n行上的被提问一次,其余行上的被提问两次

#include<stdio.h>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
int main()
{
	long long int t,k,n,m,x,y,maxx,minn,ans;
	maxx=0;
	minn=0x3f3f3f3f3f3f3f3f;
	int i,j,book[200][200];
	memset(book,0,sizeof(book));
	scanf("%lld %lld %lld %lld %lld",&n,&m,&k,&x,&y);
	if(n==1)
	{
		t=k/m;
		k%=m;
	}
	else
	{
		t=k/((2*n-2)*m);
		k%=((2*n-2)*m);
	}
	
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(!k)
			break;
			book[i][j]++;
			k--;
		}
		if(!k)
		break;
	}
	for(i=n-1;i>=2;i--)
	{
		for(j=1;j<=m;j++)
		{
			if(!k)
			break;
			book[i][j]++;
			k--;
		}
		if(!k)
		break;
	}
	if(x==1||x==n)
	ans=t+book[x][y];
	else
	ans=2*t+book[x][y];
	for(i=1;i<=m;i++)
	{
		minn=min(minn,t+book[1][i]);
		minn=min(minn,t+book[n][i]);
		maxx=max(maxx,t+book[1][i]);
		maxx=max(maxx,t+book[n][i]);
	}
	for(i=2;i<=n-1;i++)
	{
		for(j=1;j<=m;j++)
		{
			minn=min(minn,2*t+book[i][j]);
			minn=min(minn,2*t+book[i][j]);
			maxx=max(maxx,2*t+book[i][j]);
			maxx=max(maxx,2*t+book[i][j]);	
		}
	}
	printf("%lld %lld %lld\n",maxx,minn,ans);
	return 0;
}


深度学习驱动的虚拟试衣间:从CP-VTON到HR-VITON的完整实现指南 虚拟试衣(Virtual Try-On,VTON)是一项利用计算机视觉和深度学习技术,将目标服装自然地“穿”到人物图像上的智能技术。这项技术正在彻底改变在线购物体验,让消费者无需实际试穿就能预览服装的上身效果。VITON-HD是目前最常用的高分辨率虚拟试衣数据集。图像分辨率:1024×768训练集:11,647对(人物+服装)测试集:2,032对每对包含:人物全身照(front)服装平铺图(cloth)人体解析图(segmentation)姿态关键点(pose) 阅读详情

相关推荐

FreeRTOS:卡在configASSERT( ( pxQueue ) )问题的解决

FreeRTOS卡在configASSERT( ( pxQueue ) )问题的解决

qq_42007164的博客 9573

Codeforces Round #392 (Div. 2) 758C Unfair Poll 【模拟】

题目传送门:点击打开链接C. Unfair Polltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOn the Literature lesson Sergei noticed an awful injustice, it seems that...

Emiya丶的博客 277

保姆级教程:在瑞芯微RV1126B上部署轻量化YOLOv8,实现端侧实时目标检测

本文详细介绍了在瑞芯微RV1126B芯片上部署轻量化YOLOv8模型的完整流程,包括开发环境搭建、模型训练优化、量化转换及嵌入式部署。通过利用RV1126B的3TOPS NPU算力和AI-ISP特性,实现端侧实时目标检测,提升边缘AI应用的性能和效率。

weixin_30329623的博客 276

Codeforces Round #392 (Div. 2) C - Unfair Poll codeforces

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an aw

ueane的博客 402

国产射频直采收发器CX8242KA测试1

CX8242KA/CX8242KAN是一款集成了14比特,12 GSPSDAC和14比特,3GSPSADC的双通道,宽带、射频直采收发器芯片,该器件支持高达6GHz射频信号的直接采样输入和输出,集成了片内高性能采样钟模块,采样时钟Jitter

RFSOC的博客 9187

74HC138译码器的原理和使用

A0,A1,A2为3位二进制加权地址输入端口,A2A1A0顺序组成的3位2进制数对应的十进制数x控制使能端口Yx';例如当A2A1A0 = 101 时,其他门输出端全为高电平,只有Y5'为低电平。 Y0-Y7为8个输出端口,其输出电平由A0,A2,A3,E1,E2,E3决定。

diksan的博客 6万+

Codeforces Round #392 (Div. 2) C. Unfair Poll

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an aw

窦小雨的小点子 287

BUG调试案例一:RK3588+YT8531网络无法PING通调试案例

在使用 RK3588 搭配 YT8531S PHY 芯片进行网络调试时,遇到了“网络无法 Ping 通”的棘手问题。排查了两天,终于找到问题原因。为了避免大家在类似项目中走弯路,也为了加深自己对调试细节的理解,我们特意整理了本次问题的完整排查过程。本篇文章将围绕以下四个方面展开分享: 问题现象&描述 调试过程&分析 问题根源定位 注意事项提醒 举一反三(走两步)

案例文章,高速信号 2341

Codeforces Round #392 (Div. 2) C && 758C Unfair Poll(模拟)

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an aw

K键盘里的青春K 794

【深度学习|Transformer模型学习】什么是前馈神经网络(Feed-Forward Neural Network)?将前馈神经网络中的全连接层变成1*1卷积层会有什么样的效果?

【深度学习|Transformer模型学习】什么是前馈神经网络(Feed-Forward Neural Network)?将前馈神经网络中的全连接层变成1*1卷积层会有什么样的效果?

985小水博的摸鱼日常 1380

手把手教你学Simulink——逆变器场景:基于PR控制器的单相逆变器并网控制策略仿真

摘要:本文详细介绍基于PR控制器的单相逆变器并网控制策略的Simulink仿真实现。首先分析PR控制器在单相逆变应用中的优势,然后逐步讲解模型搭建过程,包括主电路设计(直流电源、全桥逆变器、L滤波器)、控制回路实现(参考电流生成、坐标变换、PR控制器设计)以及关键参数设置。通过仿真验证了PR控制器对电网频率的精确跟踪能力,并网电流THD<3%。最后提出优化建议,如加入状态观测器、自适应参数整定等改进方向。该建模方法为可再生能源系统中的逆变器控制提供了有效验证手段。

MHD0815的博客 499

Codeforces Round #392 (Div. 2)C Unfair Poll

题目大意:       一个班有n行m列座位,老师要点k个学生,老师点名的顺序是从第1行。。。。第n-1行,第n行,第n-1行。。。。。第2行,这样重复,同一行中一定是从左到右的顺序点名,问最后被点到次数最多的人被点了几次,被点到次数最少的人被点了几次,还有坐在x行y列的人被点了几次。 题目解法:      本质上就是找规律题,除了n=1和n=2的情况要分开考虑,剩下的都可以一起考虑。然后就

bigwatermlon的博客 383

【实战】基于 Inner-IoU 的 YOLOv8 优化指南:显著提升检测精度

Inner-IoU 凭借辅助边框的创新设计,成功解决了传统 IoU 损失在小目标、遮挡场景下的收敛难题,为 YOLOv8 注入了更强的定位能力。从原理剖析到代码集成,本教程已为你铺就了一条“精度提升”的实战路径。现在,不妨亲自上手尝试,让你的目标检测模型在各类数据集上都能交出一份“精度优异”的答卷——相信我,当你看到检测框精准贴合目标的那一刻,你会明白这份尝试的价值。

m0_64661770的博客 109

Codeforces Round #392(Div. 2) C Unfair Poll【思维+暴力】

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an awful injust

mengxiang000000 807

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

【找规律】Codeforces Round #392 (Div. 2) C. Unfair Poll

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an ...

weixin_33754065的博客 99

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

C. Unfair Poll-数数你会不会?

Codeforces Round #392 (Div. 2) C. Unfair Poll 就是数数,先找周期,一个周期是这样的 1 2 3 …………………………………………..m m+1, m+2, m+3 ………………………. 2m 2m+1, 2m+2, 2m+3……………………3m ………………………………………………………..

永远保持谦卑好学 383

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

Codeforces Round #392 (Div. 2)-C. Unfair Poll(xjb)

题目链接 题目大意: 数数,从第1,…n排,再从第n-1,…,1排的顺序。问一个人被问最多和最少的次数和指定人的次数。这题真的是xjb乱搞一通。。 特判只有一排和两排的。 以2*(n-1)*m为一轮 不满一轮的特判。 然后剩余k%2*(n-1)*m 暴力标记 最大的一定不在第一行和第n行。最小的一定在第n行。 不在第一行和第n行的每轮计算了两次,其他计算了一次。

No Program No Life 330

Codeforces Round #392 (Div. 2)C. Unfair Poll(找循环节)

C. Unfair Polltime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputOn the Literature lesson Sergei noticed an awful injustice, it seems that some stu

妍恐龙的博客....^~^眼熟我 312

Codeforces Round #392 (Div. 2) Unfair Poll

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an awful inju...

weixin_34342207的博客 130

Codeforces Round #382 (Div. 2)A到D题 A. Ostap and //B. Urbanization//C. Tennis Championship//D. Taxes

A. Ostap and Grasshopper time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On the way to Rio de Janeiro Ostap

jerans的博客 1289

Gym - 101128C Canvas Painting 逆向思维

https://odzkskevi.qnssl.com/3699857ff0a17d77d1099699cdf4da13?v=1490503337 刚开始读错题意,以为是不变序列,就想着区间dp但数据量肯定会t,,,没想到什么优化方法就放下了,后来队员发现序列是可变的。。。。任意的。。。。。 想着先排序在布拉布拉布拉,一直都没有逆向思维想到哈夫曼。只怪数据结构没认真听啊。。。。 想到哈夫

jerans的博客 947

CodeForces - 361D Levko and Array二分加dp

D. Levko and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Levko has an array that consists of inte

jerans的博客 840

Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C Fountains 乱搞

C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Arkady plays Gardenscapes a lot. Arkady wants

jerans的博客 811

codeforces 8VC Venture Cup 2017 - Elimination Round D PolandBall and Polygon

D. PolandBall and Polygon time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output PolandBall has such a convex poly

jerans的博客 727

B. The Meeting Place Cannot Be Changed

B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output The main road in Byt

jerans的博客 697

Codeforces Round #380 (Div. 2,Based on Technocup 2017 - Elimination Round 2)C - Road to Cine//

C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service

jerans的博客 685
上一篇: Codeforces Round #393 (Div. 2) B. Frodo and pillows
下一篇: 位运算详解及竞赛常见用法入门
jerans
博客等级 码龄10年 54粉丝 255原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值