模拟

code

  1. #include <iostream>
  2. #include <cstdio>
  3. #define LEN 1000
  4. using namespace std;
  5. int n, t;
  6. int pos[], last[], v[];
  7. int ans[];
  8. int main()
  9. {
  10. cin >> n >> t;
  11. for (int i = ; i <= n; ++i) cin >> pos[i];
  12. for (int i = ; i <= n; ++i) cin >> v[i];
  13. for (int time = ; time <= t; ++time)
  14. {
  15. for (int i = ; i <= n; ++i)
  16. last[i] = pos[i], pos[i] += v[i];
  17. for (int i = ; i <= n; ++i)
  18. for (int j = ; j <= n; ++j)
  19. if ( v[i] > && v[j] < )
  20. {
  21. if (last[j] > last[i] && pos[i] >= pos[j])
  22. ++ans[i], ++ans[j];
  23. else if (last[j] < last[i] && pos[i] - LEN >= pos[j])
  24. ++ans[i], ++ans[j];
  25. }
  26. for (int i = ; i <= n; ++i)
  27. {
  28. while (pos[i] < ) pos[i] += LEN;
  29. while (pos[i] >= LEN) pos[i] -= LEN;
  30. }
  31. }
  32. for (int i = ; i <= n; ++i)
  33. cout << ans[i] << ' ';
  34. return ;
  35. }

SGU 188.Factory guard的更多相关文章

  1. SGU 分类

    http://acm.sgu.ru/problemset.php?contest=0&volume=1 101 Domino 欧拉路 102 Coprime 枚举/数学方法 103 Traff ...

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

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

  4. Oracle12c Data Guard搭建手册

    Oracle12c Data Guard搭建手册 注:本文来源: 红黑联盟 < Oracle12c Data Guard搭建手册 > Oracle 12c 的DataGuard 是在CDB ...

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

  6. Oracle data guard学习

    Oracle data guard学习:三思笔记 Data guard 1data guard结构: data guard是一个集合,由一个primary数据库(生产数据库)和一个或多个standby ...

  7. Oracle data guard 10g 搭建

    Oracle data guard 10g 搭建 1系统常规参数检查 硬盘 [root@localhost ~]# df -h 内核 [root@localhost ~]# uname -a [roo ...

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

  9. Azure Data Factory(三)集成 Azure Devops 实现CI/CD

    一,引言 由于上一节文章内容过长,无法分享Azure Data Factory 的持续集成,持续发布.今天将着重介绍一下在使用 Azure DevOps Pipeline 发布,自动进行持续集成,并且 ...

随机推荐

  1. poj 2960 S-Nim(SG函数)

    S-Nim Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3694   Accepted: 1936 Description ...

  2. 基于curl 的zabbix API调用

    1,认证并取得加密字段 curl -i -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0&q ...

  3. 常用的MySQL图形化管理软件

    本博文的主要内容有 .SQLyog软件的安装.下载和使用 .Navicat for MySQL软件的安装.下载和使用 1.SQLyog软件的安装.下载和使用 2.Navicat for MySQL软件 ...

  4. Kafka中错误:Unrecognized VM option ‘UseCompressedOops’ Error: Clould not create the Java Vritual Machine. Error: A fatal exception has occurres . Program will exit.

    错误的描述: 在kafka安装目录下,执行 $ bin/zookeeper-server-start.sh config/zookeeper.properties & Unrecognized ...

  5. JavaEE学习笔记---数据库操作篇

    测试JDBC和SQLServer的插入操作,源码如下: import java.sql.Connection;import java.sql.DriverManager;import java.sql ...

  6. IE的Cookie目录和临时缓存目录的关系

    1.IE的Cookie位置注册表设置: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folde ...

  7. 推荐一个网站——聚合了微软的文件的Knowledge Base下载地址

    Microsoft Files是一个微软的文件数据库,从这里可以很方便的找到各个文件版本对应的下载链接. 比如今天debug需要找一个特定版本的sos.dll,从这个网站就很方便的给出了这个sos.d ...

  8. 【Android - 框架】之Glide的使用

    一.Glide简介: Glide是Google官方推荐的一个图片加载和缓存的开源库,它不仅能实现平滑的图片列表滚动效果,还支持远程图片的获取.大小调整和展示,并且可以加载GIF图片.Glide相比与U ...

  9. JS时钟钟表

    <!DOCTYPE html> <html>    <head>        <meta charset="utf-8" />   ...

  10. cocos2d-x3.0 ListView

    .h #include "cocos2d.h" #include "cocos-ext.h" #include "ui/CocosGUI.h" ...