题目:http://codeforces.com/problemset/problem/1066/A
作为一道div3的A,用总的灯笼数量减去被覆盖的灯笼数量就行了。
code:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
ll L, v, l, r;
cin >> L >> v >> l >> r;
ll ans = L / v;
ans -= r / v - (l - 1) / v;
cout << ans << endl;
}
return 0;
}
本文介绍了 CodeForces 平台上的一个问题 1066A 的解题思路和代码实现。该题目属于 div3 的 A 类型,主要讲解了如何通过计算总的灯笼数量减去被覆盖的灯笼数量来得出答案。代码使用 C++ 编写,通过输入灯笼总数和覆盖范围,输出未被覆盖的灯笼数量。
1613

被折叠的 条评论
为什么被折叠?



