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编程(16)——循环
循环就是重复一些命令的代码块,如果条件不满足就退出循环. for loops for arg in [list] 这是一个基本的循环结构.它与C的for结构有很大不同. for arg in [lis ...
- 新型Web劫持技术
该类新型Web劫持是利用script脚本实现的.在已知的案例中,黑客入侵了某地方门户网站,篡改了该网站的新闻页面,并向这些页面植入自己的广告.新闻及恶意代码.一旦用户从搜索结果页面点击进入被篡改过的新 ...
- Tree2cycle
Problem Description A tree with N nodes and N-1 edges is given. To connect or disconnect one edge, w ...
- 用PHP写的一个简单的分页类 1.0版
<?php /* 分页类 用于实现对多条数据分页显示 version:1.0 author:Knight E-Mail:S.Knight.Work@gmail.com Date:2013-10- ...
- xapian倒排索引的归并流程
Xapian的检索流程和大部分搜索系统都一样,就先从倒排表抽取候选文档,然后结合其他信息进行排序,取top文档作为搜索结果,具体流程如下: 图1 xapian搜索流程 具体流程 在terms中找到do ...
- zabbix2.2.3 VMware Vsphere exsi监控配置步骤
zabbix2.2.3 VMware Vsphere exsi监控配置步骤, 1,添加监控主机 2,添加聚集macro;{$PASSWORD} = yoodo.com{$URL} = http://i ...
- hdoj 1686 Oulipo【求一个字符串在另一个字符串中出现次数】
Oulipo Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Subm ...
- ng-repeat 遍历同值数组导致的报错
http://blog.csdn.net/tyust512/article/details/50370624
- 尝鲜basic开发android
做过android开发的同学都知道,很大精力都需要去面对界面编程,这个是非常没效率非常痛苦的一件事.偶然得知basic老树发新芽,居然还可以做android开发,决定试试效果如何. 首先上:http: ...
- DIV+CSS区块框浮动设计
在页面布局的时候,能够用绝对定位来实现,可是因为调整某个区块框时其它区块的位置不会对应的改变,所以这并非布局的首选方式.可是使用浮动的区块框能够向左或向右移动,直到它的外边缘碰到包括它区块的边框或还有 ...