您的位置:首页 > 科技 > 能源 > 网站开发工作内容_兰州疫情引起民愤_百度查重软件_站长工具是做什么的

网站开发工作内容_兰州疫情引起民愤_百度查重软件_站长工具是做什么的

2024/12/23 9:02:58 来源:https://blog.csdn.net/weixin_72770922/article/details/142350818  浏览:    关键词:网站开发工作内容_兰州疫情引起民愤_百度查重软件_站长工具是做什么的
网站开发工作内容_兰州疫情引起民愤_百度查重软件_站长工具是做什么的

#include<iostream>
using namespace std;
int const N = 200005;
int n;
long long t;
int ans = 0;
int main()
{cin >> n;for (int i = 1;i <= n;i++){cin >> t;long long test = 2;bool flag = 0;if (t == 1){ans++;}while (test <= t){if (test == t){flag = 1;break;}test *= 2;}if(flag==1)ans++;}cout << ans << endl;return 0;
}

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n;
struct num
{int nums;int cirs = 0;
};
vector<num>v;bool cmp(num num1, num num2)
{if (num1.cirs == num2.cirs){return num1.nums < num2.nums;}return num1.cirs < num2.cirs;
}
int main()
{cin >> n;int t;num nu;for (int i = 1;i <= n;i++){cin >> t;nu.cirs = 0;nu.nums = t;while (t){int x = t % 10;if (x == 8){nu.cirs += 2;}else if (x == 0 || x == 9 || x == 6 || x == 4){nu.cirs += 1;}t /= 10;}v.push_back(nu);}sort(v.begin(), v.end(), cmp);for (vector<num>::iterator it = v.begin();it != v.end();it++){cout << (*it).nums << " ";}return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
int n;
int arr[1000005];
int a[500005];
long long ans = 0;
int main()
{cin >> n;for (int i = 1;i <= n;i++){cin >> arr[i];}for (int i = 1;i <= n / 2;i++){a[i] = arr[n - i + 1] - arr[i];}for (int i = 1;i <= n / 2;i++){if (a[i] > 0){if (a[i + 1] >= a[i]){a[i + 1] -= a[i];}else if (a[i + 1] >= 0){a[i + 1] = 0;}ans += a[i];}else if (a[i] < 0){if (a[i + 1] <= a[i]){a[i + 1] -= a[i];}else if (a[i + 1] < 0){a[i + 1] = 0;}ans -= a[i];}}cout << ans << endl;return 0;
}

 

#include<iostream>
using namespace std;
int const N = 3e5 + 5;
int n, m, l[N], r[N],a[N],s[N],sum=0;
int main()
{cin >> n >> m;for (int i = 1;i <= m;i++){cin >> l[i] >> r[i];a[l[i]]++;a[r[i]+1]--;}for (int i = 1;i <= n;i++){a[i] += a[i - 1];if (a[i] == 0)sum++;s[i] = s[i - 1] + (a[i] == 1);}for (int i = 1;i <= m;i++){cout << s[r[i]] - s[l[i]-1] + sum << endl;}return 0;
}

 

 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com