题意:

  老师点名,顺序是1 -- n -- 1 排为一个循环,每列为1 -- m的顺序, 问点到最多次数和最少次数的人的次数以及(x,y)被点的次数。

分析:

  由于点名有循环,故可先判断出每一个循环每个人被点名的次数,再乘以循环数,为答案一部分。

  最后一个循环结束后k还有余数,从(1,1)暴力模拟,因为n*m才10000, 再加上前面的,就能得出答案。

  注意 n=1 需要特判。

 #include <bits/stdc++.h>
using namespace std;
#define LL long long
int mp[][];
int n, m, x, y;
LL c, k;
LL res1, res2, res3;
int main()
{
scanf("%d%d%I64d%d%d", &n, &m, &k, &x, &y);
if (n == )
{
LL a = k/m;
k %= m;
if (k == ) res1 = res2 = res3 = a;
else
{
res1 = a+;
res2 = a;
res3 = a;
if (y <= k) res3++;
}
}
else
{
memset(mp, , sizeof(mp));
c = k / ((*n-) * m);
k %= (*n-)*m;
int r = ;
while (k > )
{
if (r == )
{
for (r; r < n && k; r++)
{
for (int j = ; j <= m && k; j++)
{
++mp[r][j];
k--;
}
}
}
else if (r == n)
{
for (r; r > && k; r--)
{
for (int j = ; j <= m && k; j++)
{
++mp[r][j];
k--;
}
}
}
}
res1 = , res2 = mp[][] + c;
for (int i = ; i <= n; i++)
for (int j = ; j <= m; j++)
{
if (i == || i == n)
res1 = max(res1, mp[i][j] + c), res2 = min(res2, mp[i][j] + c);
else
res1 = max(res1, mp[i][j] + *c), res2 = min(res2, mp[i][j] + *c);
}
if (x == || x == n)
res3 = c + mp[x][y];
else
res3 = *c + mp[x][y];
}
printf("%I64d %I64d %I64d\n", res1, res2, res3);
}

CodeFroces 758C - Unfair Poll的更多相关文章

  1. Codeforces758C Unfair Poll 2017-01-20 10:24 95人阅读 评论(0) 收藏

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

  2. 【找规律】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 ...

  3. 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 ...

  4. CodeForces 758 C Unfair Poll

    Unfair Poll 题意:一共有n排同学每排同学有m个人, 老师问问题有一个顺序, 先从第一排开始问,问完第一排的所有同学之后,再问第2排的,对于所有排的访问顺序为 1,2,3……n-1,n,n- ...

  5. C. Unfair Poll

    http://codeforces.com/problemset/problem/758/C C. Unfair Poll time limit per test 1 second memory li ...

  6. 【codeforces 758C】Unfair Poll

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  7. Codeforces 758C:Unfair Poll(思维+模拟)

    http://codeforces.com/problemset/problem/758/C 题意:教室里有n列m排,老师上课点名从第一列第一排开始往后点,直到点到第一列第m排,就从第二列第一排开始点 ...

  8. CF758C Unfair Poll

    题意: On the Literature lesson Sergei noticed an awful injustice, it seems that some students are aske ...

  9. C. Unfair Poll 数学题,

    http://codeforces.com/contest/758/problem/C 需要一个能够找到任意一个位置的步数的方法,就能解决三个问题. 预处理出one(row, col)表示第一次经过这 ...

随机推荐

  1. [转帖]Linux 下实践 VxLAN:虚拟机和 Docker 场景

    Linux 下实践 VxLAN:虚拟机和 Docker 场景 https://www.cnblogs.com/bakari/p/11264520.html 实践了下 没问题 作者写的很perfect ...

  2. row_number()、rank()、dense_rank()排序方式的区别

    1.row_number() 排序策略,连续排序,它会为查询出来的每一行记录生成一个序号,依次排序且不会重复,例如1,2,3,4   SELECT names,dept,row_number() OV ...

  3. 啃掉Hadoop系列笔记(03)-Hadoop运行模式之本地模式

    Hadoop的本地模式为Hadoop的默认模式,不需要启用单独进程,直接可以运行,测试和开发时使用. 在<啃掉Hadoop系列笔记(02)-Hadoop运行环境搭建>中若环境搭建成功,则直 ...

  4. k8s-高可用架构设计

    docker的私有仓库harbor.容器化kubernetes部分组建.使用阿里云日志服务收集日志. 部署完成后,你将理解系统各组件的交互原理,进而能快速解决实际问题,所以本文档主要适合于那些有一定k ...

  5. Leetcode 杂题

    盛最多水的容器   给定 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) .在坐标内画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) ...

  6. 适配方案(二)之PC端适配

    PC端 特点 PC端的屏幕具备以下特点: 屏幕大小一般是大于 13.3英寸 用户会经常拖拉浏览器的大小 原因 正是因为 PC端上的浏览器大小会经常被改变,而且改变的范围还很大,用户会全屏浏览器,用户也 ...

  7. wpf menuitem 简约显示的 template样式

    <ControlTemplate x:Key="MenuItemControlTemplate1" TargetType="{x:Type MenuItem}&qu ...

  8. LeetCode:181.超过经理收入的员工

    题目链接:https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/ 题目 Employee 表包含所有员 ...

  9. 收下这波 JS 技巧,从此少加班

    各种业务开发都离不开对数据的处理,然而遇到的很多数据都是不好处理的.这个时候就需要寻求搜索引擎的帮助.这种方法效率是非常低下的,而且根据作者的个性不能保证其对自己的口味.因此这篇文字包含了一份 JS ...

  10. ubuntu - 14.04,安装docker(源代码管理工具)

    一,安装docker: 1,安装curl:在shell中执行:sudo apt-get install curl 2,shell中执行:curl -sSL https://get.daocloud.i ...