spoj SMPDIV - Divisibility
来源:互联网 发布:新理念外语网络教学app 编辑:程序博客网 时间:2024/06/03 08:48
Print all integers ai such that ai is divisible by x and not divisible by y, where 1 < ai < n < 100000.
Input
First, you are given t (t<100) - the number of test cases. In each of the following t lines, 3 integers: n x y.
You might assume also that x < n and x is not divisible by y.
Output
In each of the following t lines, numbers requested in the problem description in the separated by a single space in ascending order.
Example
Input:2 7 2 435 5 12Output:2 6 5 10 15 20 25 30比较简单,直接贴代码
import sysdebug = Falseif debug: stdin = sys.stdin; fin = open('f:/oj/uva_in.txt', 'r') sys.stdin = fint = int(sys.stdin.readline())while (t > 0): line = sys.stdin.readline() data = line.strip().split(' ') n = int(data[0]) x = int(data[1]) y = int(data[2]) first = True for i in range(x, n, x): if (first): first = False else: print(' ', end='') if (i % y != 0): print(i, end='') print() t = t - 1 if debug: sys.stdin = stdin
0 0
- spoj SMPDIV - Divisibility
- SPOJ:416 Divisibility by 15
- SPOJ 416. Divisibility by 15
- SPOJ 416 - Divisibility by 15(贪心)
- spoj 3196 Divisibility Relation(最大独立集输出方案)
- Divisibility
- Divisibility
- Divisibility
- Divisibility
- Divisibility
- Divisibility
- Divisibility
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- SPOJ
- 微软 Visual Studio Code 1.0 正式发布下载
- 关于C# 写Windows服务程序
- 影响力(转拆书包精华)
- mybatis 关联sql查询
- Kafka特性介绍
- spoj SMPDIV - Divisibility
- 超链接 a href 提交表单通过post方式
- HashMap实现原理分析
- php中正则表达式详解
- 深入理解C指针学习笔记八之动态内存分配函数
- jsp
- 分析输入url到页面返回的过程
- HTML入门
- MySQL Connector/C++ 操作MySQL数据库(例程)