SGU 188.Factory guard
模拟
code
#include <iostream>
#include <cstdio>
#define LEN 1000
using namespace std;
int n, t;
int pos[], last[], v[];
int ans[];
int main()
{
cin >> n >> t;
for (int i = ; i <= n; ++i) cin >> pos[i];
for (int i = ; i <= n; ++i) cin >> v[i];
for (int time = ; time <= t; ++time)
{
for (int i = ; i <= n; ++i)
last[i] = pos[i], pos[i] += v[i];
for (int i = ; i <= n; ++i)
for (int j = ; j <= n; ++j)
if ( v[i] > && v[j] < )
{
if (last[j] > last[i] && pos[i] >= pos[j])
++ans[i], ++ans[j];
else if (last[j] < last[i] && pos[i] - LEN >= pos[j])
++ans[i], ++ans[j];
}
for (int i = ; i <= n; ++i)
{
while (pos[i] < ) pos[i] += LEN;
while (pos[i] >= LEN) pos[i] -= LEN;
}
}
for (int i = ; i <= n; ++i)
cout << ans[i] << ' ';
return ;
}
SGU 188.Factory guard的更多相关文章
- SGU 分类
http://acm.sgu.ru/problemset.php?contest=0&volume=1 101 Domino 欧拉路 102 Coprime 枚举/数学方法 103 Traff ...
- org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/lonecloud/tomcat/apache-tomcat-7.0.70 2/webapps/myproject/WEB-INF/classes/cn/lone
解决这个报错的解决办法: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidat ...
- Spring错误之org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'bookService' is expected to be of type 'pw.fengya.tx.BookService' but was actually of type 'com.sun.proxy.$Proxy1
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cas ...
- Oracle12c Data Guard搭建手册
Oracle12c Data Guard搭建手册 注:本文来源: 红黑联盟 < Oracle12c Data Guard搭建手册 > Oracle 12c 的DataGuard 是在CDB ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource
二月 20, 2017 3:09:47 下午 org.apache.catalina.startup.SetAllPropertiesRule begin警告: [SetAllPropertiesRu ...
- Oracle data guard学习
Oracle data guard学习:三思笔记 Data guard 1data guard结构: data guard是一个集合,由一个primary数据库(生产数据库)和一个或多个standby ...
- Oracle data guard 10g 搭建
Oracle data guard 10g 搭建 1系统常规参数检查 硬盘 [root@localhost ~]# df -h 内核 [root@localhost ~]# uname -a [roo ...
- Log4j2 - Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFileAppender for element RollingFile
问题与分析 在使用Log4j2时,虽然可以正确读取配置文件并生成log文件,但偶然发现控制台打印了异常信息如下: 2018-12-31 17:28:14,282 Log4j2-TF-19-Config ...
- Azure Data Factory(三)集成 Azure Devops 实现CI/CD
一,引言 由于上一节文章内容过长,无法分享Azure Data Factory 的持续集成,持续发布.今天将着重介绍一下在使用 Azure DevOps Pipeline 发布,自动进行持续集成,并且 ...
随机推荐
- Linux Shell编程(24)——命令替换
命令替换 将会重新分配一个命令[1]甚至是多个命令的输出; 它会将命令的输出如实地添加到另一个上下文中. [2]使用命令替换的典型形式是使用后置引用(`...`). 后置引用形式的命令(就是被反引号括 ...
- 汇编学习笔记(14)BIOS对键盘输入的处理
字符的处理 键盘输入的字符一般由int9中断例程从60h端口中读取,并存放在键盘缓冲区中,由int16h例程从键盘缓冲区中读取相应字符,CPU对键盘输入a.shift_a的处理过程如下 1.一开始没有 ...
- Supervisord管理
原文地址:http://blog.csdn.net/fyh2003/article/details/6837970 学习笔记 Supervisord可以通过sudo easy_install supe ...
- Bzoj 2038: [2009国家集训队]小Z的袜子(hose) 莫队,分块,暴力
2038: [2009国家集训队]小Z的袜子(hose) Time Limit: 20 Sec Memory Limit: 259 MBSubmit: 5763 Solved: 2660[Subm ...
- Ubuntu 下安装opencv 编译后执行找不到库
在ubuntu下编译opencv程序后,执行报下面到错误:error while loading shared libraries: libopencv_core.so.2.4: cannot ope ...
- wikioi 1154 能量项链 (2006年NOIP全国联赛提高组)
题目描述 Description 在Mars星球上,每个Mars人都随身佩带着一串能量项链.在项链上有N颗能量珠.能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数.并且,对于相邻的两颗珠子 ...
- CENTOS 7 开放端口设置
CentOS 7 默认没有使用iptables,所以通过编辑iptables的配置文件来开启80端口是不可以的 CentOS 7 采用了 firewalld 防火墙 如要查询是否开启80端口则: [r ...
- 软中断与硬中断 & 中断抢占 中断嵌套
参考了这篇文章:http://blog.csdn.net/zhangskd/article/details/21992933 从本质上来讲,中断是一种电信号,当设备有某种事件发生时,它就会产生中断,通 ...
- 浅谈数据结构-Boyer-Moore算法
上文讲解了KMP算法,这种算法在字符串匹配中应用比较少,在各种文本编辑器中的查找功能大多采用Boyer-Moore算法.1977年,德克萨斯大学的Robert S. Boyer教授和J Strothe ...
- Linux下对后台进程通过kill传递信号不起作用的问题
在阅读APUE信号一章时,我遇到Linux下对后台进程通过kill传递信号不起作用的问题 具体情形与如下链接中的老兄一致: http://bbs.csdn.net/topics/390335913?p ...