游客 Signup | Login
中文 | En

1857 - 整除个数

1、2、3… …n这n(0<n<=1000000000)个数中有多少个数可以被正整数b整除。

Input

输入包含多组数据
每组数据占一行,每行给出两个正整数n、b。

Output

输出每组数据相应的结果。

Examples

Input

2 1
5 3
10 4

Output

2
1
2

Solution C

#include <stdio.h>
int main(){
    long long n, b, cnt;
    while(scanf("%lld %lld", &n, &b) != EOF){
        int i;
        cnt = 0;
        for(i = b; i <= n; i += b) cnt++;
        printf("%lld\n", cnt);
    }
    return 0;
}

Solution C++

#include "cstdio"
int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
		printf("%d\n",a/b);
	return 0;
}
Time Limit 3 seconds
Memory Limit 128 MB
Discuss Stats
上一题 下一题