Codeforces 758C-   Unfair Poll

PYNQ-Z2 开发板从镜像烧录到 Jupyter 交互全流程指南 本文详细介绍了PYNQ-Z2开发板从镜像烧录到Jupyter交互的全流程指南,包括硬件解析、镜像烧录技巧、设备启动与网络配置、Jupyter Notebook深度使用以及实战案例分享。通过具体步骤和实用技巧,帮助开发者快速上手PYNQ-Z2开发板,实现高效的FPGA开发和智能家居控制应用。 阅读详情

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:

    the maximum number of questions a particular pupil is asked,
    the minimum number of questions a particular pupil is asked,
    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:

    the maximum number of questions a particular pupil is asked,
    the minimum number of questions a particular pupil is asked,
    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:

    the pupil from the first row who seats at the first table, it means it is Sergei;
    the pupil from the first row who seats at the second table;
    the pupil from the first row who seats at the third table;
    the pupil from the first row who seats at the first table, it means it is Sergei;
    the pupil from the first row who seats at the second table;
    the pupil from the first row who seats at the third table;
    the pupil from the first row who seats at the first table, it means it is Sergei;
    the pupil from the first row who seats at the second table;

The order of asking pupils in the second test:

    the pupil from the first row who seats at the first table;
    the pupil from the first row who seats at the second table;
    the pupil from the second row who seats at the first table;
    the pupil from the second row who seats at the second table;
    the pupil from the third row who seats at the first table;
    the pupil from the third row who seats at the second table;
    the pupil from the fourth row who seats at the first table;
    the pupil from the fourth row who seats at the second table, it means it is Sergei;
    the pupil from the third row who seats at the first table;





题目大意:有n行m列学生,有一位老师在课上会问k个问题,在行上,是按照1,2。。。。n-1,n,n-1.。。。1这样的顺序提问,求学生当中回答问题个数最多和最少的个数,以及在第x行第y位的同学回答的问题数。

要学习别人的代码.

#include<bits/stdc++.h>

using namespace std;

#define LL long long
#define MP(a,b) make_pair(a,b)
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=a;i<=b;++i)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define pii pair<int,int>
#define sf scanf
#define pf printf

const int maxn = 100;

int n, m, xx, yy;
LL kk, mmp[maxn+5][maxn+5];

int main()
{
    sf("%d%d%lld%d%d", &n, &m, &kk, &xx, &yy);
    LL a, b, c, ans1, ans2, ans3;
    int type;
    if(n == 1)
    {
        ans1 = ans2 = kk/m, b = kk%m;
        if(b) ++ans1;
        ans3 = (yy<=b) ? ans1 : ans2;
        pf("%lld %lld %lld\n", ans1, ans2, ans3);
        return 0;
    }
    a = (n-1)*m*2;
    b = kk/a, c = kk%a;
    mem(mmp, 0);
    REP(i,1,n-1) REP(k,1,m)//这个学
        mmp[i][k] += b;//都直接放到这里面就不怕了.不会犯特例的错
    REP(i,2,n) REP(k,1,m)
        mmp[i][k] += b;
    int ti = 1, tk = 1;
    while(ti<n && c)
    {
        ++mmp[ti][tk], ++tk, --c;
        if(tk==m+1) ++ti, tk = 1;
    }
    while(ti>=1 && c)
    {
        ++mmp[ti][tk], ++tk, --c;
        if(tk==m+1) --ti, tk = 1;
    }
    LL mx = 0, mm = 1e18;
    REP(i,1,n) REP(k,1,m)
    {
        mx = max(mx, mmp[i][k]);
        mm = min(mm, mmp[i][k]);
    }
    pf("%lld %lld %lld\n", mx, mm, mmp[xx][yy]);
    return 0;
}
同步调相机启动与并网控制技术方案 同步调相机起动与并网控制技术方案采用背靠背变流器系统,通过静止变频器(SFC)策略实现无原动机驱动的同步电机从静止到同步转速的平稳起动。方案详细阐述了硬件自检、模块初始化、转子位置检测等关键环节,重点解决启动转矩为零、冲击电流大等挑战。系统基于STM32或C2000系列控制器,包含网侧/机侧变流器、检测保护单元及通信接口,通过励磁脉冲和电压响应分析实现高精度转子初始定位,为后续并网提供必要条件。代码级实现涵盖了ADC自检、数字IO验证及通信端口测试等核心功能。 阅读详情

相关推荐

【MMDetection3.0实战】从零构建自定义数据集训练流程

本文详细介绍了使用MMDetection3.0框架从零开始构建自定义目标检测数据集的完整训练流程。内容涵盖环境配置、COCO格式数据准备、核心代码改造、模型配置与训练策略调优,以及最终的模型测试与验证,帮助开发者快速上手并训练自己的检测模型。

l6m7n8的博客 314

Codeforces 758C. Unfair Poll

题目大意: 在一个\(n*m\)的棋盘上连续进行k次操作,每次操作会把格子里的数+1,初始为零.操作的顺序见题解.问最大值,最小值以及某一格子上的数。\(n,m\leq100,k\leq10^{18}\) 题解: 由于操作的时候对于行是:\(1,2,3,..,n,n-1,n-2,...,1,2,3,...\) 对于列是:\(1,2,3,...,n,1,2,3,...\) 所以我们把\(1..n.....

weixin_30354675的博客 152

硅纪元应用测评 | AI搜索引擎大比拼:360AI搜索、秘塔搜索、GenSpark AI和天工AI对比评测

搜索引擎输出的每个段落都有对应的出处,如果有错误,也是信息源的问题,从普通用户的角度来看,这与AI搜索的产品关系不大,能让用户对AI搜索的服务和得到的信息有一个隔离。同时,提供更多的定制选项,允许用户根据自己的偏好调整搜索结果的权重和排序,将使得搜索体验更加个性化和满足用户的具体需求。此外,大部分搜索工具还提供了一个无广告的搜索环境(360AI搜索部分内容会有广告),极大地提升了用户的搜索体验。AI搜索的本质依然是搜索,但它通过AI的逻辑分析和语言重新组织,使用户能够快速得到想要的信息。

guijiyuantech的博客 2013

【codeforces 758C】Unfair Poll

time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output On the Literature lesson Sergei noticed an awful injustice, it seems that som...

AWCXV 123

基于Java的高校学生信息管理系统的设计与实现(论文+源码)

可以对本系统的数据进行良好的封装,Java可以对不想被访问的数据进行良好的隐藏,具备平台无关性,可移植,更加可靠与安全,具备多线程支持,进行网络交互更容易。它支持本系统的B/S模式。开发效益方面,本系统一旦开发成功并且面向社会,就会让大多数的学生教师体会到便利办公的乐趣,随之促进提高本系统的使用率和经济利润,所以在经济方面,对于零成本开发且高利润的学生管理系统是可行的。学生可以在学生端进行选课,查看自己的成绩,教师可以在教师端查看所任课程的选课情况,对学生成绩进行录入,对所任的课程进行结课等操作。

2402_82389843的博客 1092

RAG系统中Reranker模型选型实战

本文详细介绍了RAG系统中Reranker模型选型实战,希望能对学习RAG的同学们有所帮助。 文章目录 1. 前言 2. 思路解析 3. 测评数据集构建 3.1 步骤一 3.2 步骤二 3.3 数据示例 3.4 总结 4. 实战代码 4.1 本地模型 4.2 使用第三方的Reranker模型API

herosunly的博客 17万+

【Codeforces 758 C Unfair Poll】+ 细节

C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputOn the Literature lesson Sergei noticed an awful injustice, it seems t

楚江枫 505

基于QT与STM32的电力参数采集系统(华为云IOT)(211)

本项目构建一款集多功能于一体的电力参数采集系统,该系统以高性能、低功耗的STM32F103RCT6微控制器为核心,集成多种传感器与通信模块,实现对电力设施如电压、电流、功率、电能及环境温度等关键参数的实时精确采集,并通过GPS模块获取设备地理位置信息,满足了电力设备状态全面监控的需求。

2903

CodeForces 758 C Unfair Poll

Unfair Poll 题意:一共有n排同学每排同学有m个人, 老师问问题有一个顺序, 先从第一排开始问,问完第一排的所有同学之后,再问第2排的,对于所有排的访问顺序为 1,2,3……n-1,n,n-1,n-2,……,2,1,2,然后每次访问到新的一排先要问完这一排的所有人才会往下一(目标)排走。 题解:先声明我们开一个数组来记录这一排被询问的总次数,先将k /= m, 这个代表的...

dengpangbu3703的博客 156

2026年摩尔线程数字IC面试试卷带答案

本文摘要: 该试卷为数字IC设计笔试,满分120分,时长90分钟,包含单选题、波形分析题、多选题和代码设计题。重点考察时序约束(如set_false_path)、建立/保持时间、逻辑化简、复位机制、AXI协议、半导体工艺、状态机、GPU架构等核心知识点。多选题涉及异步FIFO设计、Verilog综合、亚稳态处理、C++关键字和低功耗技术。代码题要求实现单比特信号去毛刺电路,需稳定4个时钟周期才输出。试题解析详细,标注了企业面试高频考点,如摩尔线程自研的MUSA架构和花港GPU架构特点。整体内容专业性强,覆盖

Open 98

《UDS协议从入门到精通》系列——图解0x2E:通过ID写数据

图解数据包格式+直观的通信示例,迅速认识0x2E服务!!

车载系统攻城狮 3602

Codeforces 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 awful injust

shyoldman的博客 329

AI摄影师:自动构图与修图算法设计

AI摄影师:自动构图与修图算法设计​ ,人工智能,计算机视觉,大模型,AI,AI 摄影师的核心能力体现在两方面:自动构图(通过算法优化画面元素布局)与智能修图(自动调整光影、色彩、细节)。例如,手机摄影中的 “AI 构图建议” 功能可实时框选最佳拍摄区域,修图软件中的 “一键增强” 能在 0.1 秒内完成专业级调色,这些都依赖于计算机视觉与深度学习的深度融合。

不踩坑,不知道坑有多深;不总结,踩过的坑白踩。 16万+

Unfair Poll CodeForces - 758C (思维+细心)

Unfair Poll CodeForces - 758C 题意:给出五个数,班级内的人数,n行每行m人,k个问题,se在的位置(x,y).老师提问的方式是1,2,..n-1,n,n-1,...2,1.问班级内最多被问的次数,最少被问的次数,se被问的次数。 思路:啊错了好多次,因为我是分情况写的,然后就好多没有考虑到,然后就在wawawawa..... 首先要分n==1时候,n==2时...

DeathYmz的博客 415

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Codeforces 758C Unfair Poll 暴力模拟

点击打开链接 题意 n*m个座位 提问顺序从row:1 2 ...n n-1 ...2 1 ..  每行都是从1~m提问 问总共有k次提问 被问到最多,最少和在(x,y)的学生被提问的次数? 1 由于k较大 定row1~ n n-1 ~ 2 为一个周期,则有X=k/((n+n-1)*m)个周期,除了row1,n被访问X次以外,其余都被访问2*X次 剩下k%((n+n-1)*m) 由于n,m

Masamiiiiii 694

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

Codeforces 758C Unfair Poll 【数学】【思维】

题目链接:http://codeforces.com/contest/758/problem/C   题目大意: 有 n 行,每行有 m 个学生,老师首先从(1,1)开始叫,一直叫到(n,m),再叫到(1,1),以此类推,问最后,被老师叫到次数最多的那个次数,叫到次数最小的那个次数,一个人被叫到的次数(这人的坐标是(x,y))。 题解: 本题是一个不错的题目,很锻炼思维(小心被 hack...

BlueSky 397

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Codeforces 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

J. Cole 331

CodeForces 758C Unfair Poll(模拟)

CodeForces 758C  Unfair Poll(模拟)           模拟题,需要注意很多细节,我写的代码有点麻烦,弄个图很直观     #include #include #include #include #include #include #include #include #include #include #include using n

GYH0730的博客 358

【CodeForces - 758C Unfair Poll】 暴力 + 模拟

D - Unfair Poll 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

于心有愧丶 409

Codeforces 758C-Unfair Poll

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

wang_128的博客 694

Codeforces758C 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

Jelly_acm的博客 497

codeforces 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 awful injust

YitongJun的博客 951

Unfair Poll CodeForces - 758C

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 e

海绵的博客 342
上一篇: Codeforces Round #392(Div. 2) B Blown Garland【暴力枚举】
下一篇: HDU 6215 2017Brute Force Sorting 青岛网络赛 队列加链表模拟
sega_handsome
博客等级 码龄10年 7粉丝 164原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值