博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SGU 188.Factory guard
阅读量:7238 次
发布时间:2019-06-29

本文共 1065 字,大约阅读时间需要 3 分钟。

模拟

code

#include 
#include
#define LEN 1000using namespace std;int n, t;int pos[30], last[30], v[30];int ans[30];int main(){ cin >> n >> t; for (int i = 1; i <= n; ++i) cin >> pos[i]; for (int i = 1; i <= n; ++i) cin >> v[i]; for (int time = 1; time <= t; ++time) { for (int i = 1; i <= n; ++i) last[i] = pos[i], pos[i] += v[i]; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) if ( v[i] > 0 && v[j] < 0 ) { 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 = 1; i <= n; ++i) { while (pos[i] < 0) pos[i] += LEN; while (pos[i] >= LEN) pos[i] -= LEN; } } for (int i = 1; i <= n; ++i) cout << ans[i] << ' '; return 0;}

 

转载于:https://www.cnblogs.com/keam37/p/3963306.html

你可能感兴趣的文章
Oracle %TYPE 和 %ROWTYPE
查看>>
信号与系统快速学习
查看>>
BZOJ 4517 组合数+错排
查看>>
POJ 1200 Hash
查看>>
Go语言基础之函数
查看>>
编译驱动程序出现__RTC_CheckEsp未解析的解决办法
查看>>
javascript实现九九乘法表
查看>>
Eclipse的WorkingSet使用(转载)
查看>>
缓存系列之五:通过codis3.2实现redis3.2.8集群的管理
查看>>
网络层:IP网际协议 ifconfig -a
查看>>
Eclipse oxygen 版本汉化教程
查看>>
Centos6 安全防护设置指南
查看>>
libgdx 3D 瞄准星和隐藏鼠标
查看>>
一个用于统计函数调用消耗时间的装饰器
查看>>
Codeforces Round #425 (Div.2)
查看>>
数组排序总结
查看>>
请听一个故事------>三个70多岁老人的创业故事(励志)
查看>>
民用对讲机的基础知识
查看>>
Selenium UI自动化测试 Selenium Automatic Testing
查看>>
图片的存储
查看>>