您的位置:首页 > 其它

HDU - 2099 整除的尾数

2016-08-21 23:20 344 查看
注意一下输出,当答案小于 10 的时候前面要添 0。

INPUT
2 9
0 0
OUTPUT
08 17 26 35 44 53 62 71 80 89 98
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int ans[200];
int main() {
int a, b;
while (scanf("%d%d",&a, &b) != EOF && a+b) {
int c = (a + 1) * 100;
a = a * 100;
int tag = 0;
for (int i = a; i < c; i++)
if (i%b == 0)
ans[tag++] = i;

for (int i = 0; i < tag-1; i++)
printf("%02d ", ans[i] - a);
printf("%02d\n", ans[tag-1] - a);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: