[5211]:Mutiple
2016-03-17 14:36
232 查看
a sequence a[1..N]. // 数组判断从1开始,而不是0
sequence of N integers. // n为每个测试组的测试量
For every index i, WLD wants to find the smallest index F(i) ( if exists ), that i**大于F(i)小于等于**n // 这里说明一遇到整除即停止,它只要知道整除的数是第几个
and aF(i) mod ai = 0. If there is no such an index F(i), we set F(i) as 0.
5.There are Multiple Cases.(At MOST 10) // 输入的测试组数至少为10
6.The first line contains one integers N(1≤N≤10000). // 测试组的测试量的范围
/* author : Yangchengfeng */ #include<stdio.h> #define N 10000 int main() { int n; while(scanf("%d", &n)!=EOF){ int i = 1, j, a , sum = 0; for(; i<=n; i++){ scanf("%d", &a[i]); } for(i = 1; i<=n; i++){ for(j=i+1; j<=n; j++){ if (a[j] % a[i] == 0){ sum += j; break; } } } printf("%d\n", sum); } return 0; }
相关文章推荐
- spark,scala
- HTML5事件——contextmenu 隐藏鼠标右键菜单
- 观察者设计模式
- HTML5的canvas标签
- Node.js实用代码段之获取Buffer对象字节长度
- Git常用命令
- 浅谈java泛型
- WPS PBC方法不安全,参见规范中的描述
- SqlServer 添加列并赋值
- Windows消息机制概述
- HTML5使用canvas绘制图形
- 移动端1px细线解决方案总结
- 移动端1px细线解决方案总结
- Mac/Linux编译OpenCV程序
- JavaScript 字符串(String) 对象
- iOS 子视图 父视图 UIView 相关的方法
- 从今天开始写博客了
- 两台机器免密码登录
- TestNG
- 关于移动端1px边框问题