49,425
社区成员




1、裁纸刀
#include <iostream>
using namespace std;
int main()
{
cout<< 4+(20-1)+(22-1)*20 << endl;
return 0;
}
2、刷题统计
#include <iostream>
using namespace std;
typedef long long LL;
int main()
{
LL a, b ,n;
cin >> a >> b >> n;
LL c = 5 * a, d = 2 * b;
LL res = 0;
if(n <= c + d)
{
if(n >= c)
{
res += 5;
if(n - (c) > b)
{
res += 2;
}
else res += 1;
}
else
{
if(n % a != 0) res = (n / a) + 1;
else res = n / a;
}
}
else
{
LL h = n % (c + d);
res += (n / (c + d)) * 7;
if(h >= c)
{
res += 5;
if((h - c) > b)
{
res += 2;
}
else res += 1;
}
else
{
if(h % a != 0) res += (h / a) + 1;
else res += h / a;
}
}
cout << res << endl;
return 0;
}
3、修建灌木
#include <iostream>
using namespace std;
int n;
const int N = 1e4 + 10;
int a[N] = {0};
int main()
{
cin >> n;
for(int i = 1; i <= n/2; i++)
{
a[i] = 2 * (n - i);
}
if(n % 2 != 0)
{
a[(n / 2) + 1] = 2 * (n / 2);
for(int i = (n / 2) + 2; i <= n; i++)
{
a[i] = a[n + 1 - i];
}
}
else
{
for(int i = (n / 2) + 1; i <= n; i++)
{
a[i] = a[n - i + 1];
}
}
for(int i = 1; i <= n; i++)
{
cout << a[i] << endl;
}
return 0;
}
4、k倍区间
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 100010;
typedef long long LL;
LL s[N], cnt[N];
int n, k;
int main ()
{
cin >> n >> k;
for(int i = 1; i <= n; i++)
{
scanf("%d", &s[i]);
s[i] += s[i - 1];
}
cnt[0] = 1;
LL res = 0;
for(int i = 1; i <= n; i++)
{
res += cnt[s[i] % k];
cnt[s[i] % k]++;
}
printf("%lld\n", res);
return 0;
}