Codeforces 392 C Unfair Poll(模拟)
题意:老师点名顺序规则如下:第1排,第2排,……,第n-1排,第n排,第n-1排,……,第2排,第1排,第2排,……,第n-1排,第n排,……对于每排都是从左到右依次点名,问点名k个人后,所有人中最多的点名次数,最少的点名次数,以及位于x排y列处的同学的点名次数。
分析:
1、由于k很大,将第1排,第2排,……,第n-1排,第n排,第n-1排,……,第2排看成一个循环。
2、这个循环中有2*(n-1)*m个人,注意当n=1时,这个循环中有m个人,将这个循环人数记为tmp。
3、利用k/tmp,算出每个人在k/tmp次循环后的点名次数,再按点名规则将第k/tmp + 1次循环中应当被点到名的人涂色即可。
#include<bits/stdc++.h>
#define Min(a, b) ((a < b) ? a : b)
#define Max(a, b) ((a < b) ? b : a)
typedef long long LL;
typedef unsigned long long LLU;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const int dr[] = {, , -, , -, -, , };
const int dc[] = {-, , , , -, , -, };
const int MOD = 1e9 + ;
const double pi = acos(-1.0);
const double eps = 1e-;
const int MAXN = + ;
const int MAXT = + ;
using namespace std;
LL ans[MAXN][MAXN];
int main(){
LL n, m, k, x, y;
while(scanf("%I64d%I64d%I64d%I64d%I64d", &n, &m, &k, &x, &y) == ){
memset(ans, , sizeof ans);
LL tmp = (n == ) ? m : * (n - ) * m;
for(LL j = ; j <= m; ++j){
for(LL i = ; i <= n; ++i){
if(i == || i == n) ans[i][j] = k / tmp;
else ans[i][j] = k / tmp * ;
}
}
LL yu = k % tmp;
for(LL i = ; i <= n; ++i){
for(LL j = ; j <= m; ++j){
if(yu){
++ans[i][j];
--yu;
}
else break;
}
}
for(LL i = n - ; i > ; --i){
for(LL j = ; j <= m; ++j){
if(yu){
++ans[i][j];
--yu;
}
else break;
}
}
LL ma = ;
LL mi = 1e18;
for(LL i = ; i <= n; ++i){
for(LL j = ; j <= m; ++j){
ma = Max(ma, ans[i][j]);
mi = Min(mi, ans[i][j]);
}
}
printf("%I64d %I64d %I64d\n", ma, mi, ans[x][y]);
}
return ;
}
Codeforces 392 C Unfair Poll(模拟)的更多相关文章
- CodeForces 758 C Unfair Poll
Unfair Poll 题意:一共有n排同学每排同学有m个人, 老师问问题有一个顺序, 先从第一排开始问,问完第一排的所有同学之后,再问第2排的,对于所有排的访问顺序为 1,2,3……n-1,n,n- ...
- Codeforces 758C:Unfair Poll(思维+模拟)
http://codeforces.com/problemset/problem/758/C 题意:教室里有n列m排,老师上课点名从第一列第一排开始往后点,直到点到第一列第m排,就从第二列第一排开始点 ...
- 【codeforces 758C】Unfair Poll
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 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 ...
- 【找规律】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 ...
- C. Unfair Poll
http://codeforces.com/problemset/problem/758/C C. Unfair Poll time limit per test 1 second memory li ...
- 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 ...
- CodeForces.158A Next Round (水模拟)
CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...
- Codeforces 747C:Servers(模拟)
http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开 ...
随机推荐
- detectron2 配置记录
1. RuntimeError: Not compiled with GPU support (ROIAlign_forward at /home/oliver/PycharmProjects/det ...
- MAC电脑如何播放.SWF文件
很简单,不需要专门的播放器,只需要将.swf文件直接拖拽到浏览器页面就可以播放了. 亲测safari , 谷歌chrome浏览器,火狐浏览器 ,都是可以的 下面是图示 step1 电脑上找到swf文件 ...
- 实战mysql存储程序与定时器
home198979 实战mysql存储程序与定时器 博客分类: mysql 存储过程定时器eventprocedure实战 需求:一个庞大的日志表,现每天做定时统计一天的总数,放另一个表中,方便查 ...
- intel关于spark gc的优化建议
Apache Spark由于其出色的性能.简单的接口和丰富的分析和计算库而获得了广泛的行业应用.与大数据生态系统中的许多项目一样,Spark在Java虚拟机(JVM)上运行.因为Spark可以在内存中 ...
- 题解 P3258 【[JLOI2014]松鼠的新家】
树链剖分板子题 先说点别的 小熊维尼啊,嘿嘿嘿. 写题经历 悲惨命运:树剖调了2天,一直90分,死活不AC,调出了心病,快下课时改了一下数据范围,A了--.(刚开始数组开了800100,改120010 ...
- 复习hibernate
Hibernate是一个开放源代码的对象关系映射框架,它对JDBC进行了非常轻量级的对象封装,使得Java程序员可以随心所欲的使用对象编程思维来操纵数据库. Hibernate可以应用在任何使用JDB ...
- 吴裕雄--天生自然JAVAIO操作学习笔记:IO操作实例、Scanner、数据操作流与合并流
import java.io.* ; public class ExecDemo01{ public static void main(String args[]) throws Exception{ ...
- QQ企业通---DllImport
1.DllImport 是什么? DllImport是System.Runtime.InteropServices命名空间下的一个属性类,其功能是提供从非托管DLL(托管/非托管是微软的.net fr ...
- 宏碁发布两款全A平台笔记本:良心价
导读 8月3日消息,在全球数码互动娱乐盛会ChinaJoy上,宏碁推出全新两款全A平台笔记本——暗影骑士4 锐龙版酷冷游戏本和蜂鸟Swift3锐龙版金属轻薄本. 此次发布的宏碁暗影骑士4 锐龙版笔记本 ...
- 2-10 就业课(2.0)-oozie:3、安装2
第七步:修改oozie-site.xml cd /export/servers/oozie-4.1.0-cdh5.14.0/conf vim oozie-site.xml 如果没有这些属性,直接添加进 ...