传送门

虽然是模拟,但是我们可以用矩阵保存结果,来是其更加简便。

——代码

 #include <cstdio>
#include <iostream> int map[][] = {{, , , , },
{, , , , },
{, , , , },
{, , , , },
{, , , , }};
int n, x, y, ans1, ans2;
int a[], b[]; inline int read()
{
int x = , f = ;
char ch = getchar();
for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = -;
for(; isdigit(ch); ch = getchar()) x = (x << ) + (x << ) + ch - '';
return x * f;
} int main()
{
int i, j;
n = read();
x = read();
y = read();
for(i = ; i < x; i++) a[i] = read();
for(i = ; i < y; i++) b[i] = read();
i = ;
j = ;
while(n--)
{
ans1 += map[a[i]][b[j]];
ans2 += map[b[j]][a[i]];
i = (++i) % x;
j = (++j) % y;
}
printf("%d %d\n", ans1, ans2);
return ;
}

最新文章

  1. jsp原理
  2. R笔记 map_leaflet googlevis
  3. [reprint]如何编写引导程序 Hello World
  4. Django中级篇(上)
  5. PHP 有关上传图片时返回HTTP 500错误
  6. ios开发之IBOutlet和IBAction的区别
  7. OD: Kernel Exploit - 2 Programming
  8. Android 使用Post方式提交数据(登录)
  9. CSS技巧和经验列表
  10. Android中文API (110) —— CursorTreeAdapter
  11. linux中probe函数传递参数的寻找(下)
  12. 年月日时分秒毫秒+随机数getSerialNum
  13. 论文笔记系列-Simple And Efficient Architecture Search For Neural Networks
  14. numpy.newaxis()
  15. cocos2d-x JS 计算赋值时出现 NaN
  16. 利用cookie存放模糊查询的信息
  17. python 的print和特殊方法 __str__和__repr__
  18. 怎么选择软件许可证,Apache, MIT, BSD, GPL, Mozilla, LGPL
  19. 使用yii AR 完成单个表的CURD操作
  20. 优步uber司机不能绑定银行卡问题

热门文章

  1. 题解报告:hdu 2546 饭卡(01背包)
  2. MyEclipse配置Tomcat
  3. FileStream和BinaryReader,BinaryWriter,StreamReader,StreamWriter的区别
  4. [转]Monkey测试简介
  5. android开发学习——android studio 引入第三方库的总结
  6. 外文翻译 《How we decide》 Introduction
  7. mui 时间日期控件(浏览器上无法查看,在手机端可以点击)
  8. Farseer.net轻量级开源框架 中级篇:BasePage、BaseController、BaseHandler、BaseMasterPage、BaseControls基类使用
  9. WOJ600——水题
  10. ssh设置免秘钥登录