普及组—2023年2.12日打卡
T1
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e4+10;
typedef long long LL;
LL ans=0x3f3f3f3f;
int n;
int a[N], s[N*2];
int main()
{
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int i=0; i<n; i++)
{
LL sum=0;
for(int j=1; j<n; j++)
sum+=j*a[(i+j)%n];
/*
for(int j=i+1; i!=j; j=(j+1)%n)
sum+=((j+n-i)%n)*a[j%n];
*/
ans=min(ans,sum);
}
cout<<ans;
return 0;
}
T2
class Solution {
public:
void reOrderArray(vector<int> &array) {
int l=0, r=array.size()-1;
while(l<r)
{
while(l<r && array[l]%2!=0) l++;
while(l<r && array[r]%2==0) r--;
if(l<r) swap(array[l],array[r]);
}
}
};
T3
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n,s;
bool huiwen(int x,int h)
{
string s;
while(x)
{
s+=((x%h)+'0');
x/=h;
}
string ss=s;
reverse(ss.begin(), ss.end());
if(ss==s) return true;
else return false;
}
bool check(int x)
{
int res=0;
for(int i=2; i<=10; i++)
if(huiwen(x,i)) res++;
return res>=2;
}
int main()
{
cin>>n>>s;
for(int i=s+1; n; i++)
{
if(check(i))
{
cout<<i<<endl;
n--;
}
}
return 0;
}
T4
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1005;
int x[N];
int n,res;
int main()
{
cin>>n;
for(int i=1; i<=n; i++) cin>>x[i];
sort(x+1,x+1+n);
for(int i=1; i<=n; i++)
for(int j=i+1; j<=n; j++)
{
int l=lower_bound(x+1,x+n+1,2*x[j]-x[i])-(x+1);
int r=upper_bound(x+1,x+n+1,3*x[j]-2*x[i])-(x+1);
res+=r-l;
}
cout<<res;
return 0;
}
...全文
相关推荐
逸尚YSK-1280 打卡钟快速设置手册
##### 2. 高级设置**换日时间设定**:可根据公司作息制度,自定义一天的结束时间,默认通常为午夜零点。**卡片规格设定**:一般无需调整,除非有特殊需求,如卡片大小或材质不同。
【满分】【华为OD机试真题2023 JAVA&JS】异常的打卡记录
异常的打卡记录 知识点数组字符串哈希表循环 时间限制:1s空间限制:256MB限定语言:不限 题目描述:考勤记录是分析和考核职工工作时间利用情况的原始依据,也是计算职工工资的原始依据,为了正确地计算职工工资和监督工资基金使用情况,公司决定对员工的手机打卡记录进行异常排查。
基于C++与多语言融合的练习打卡项目设计源码
此外,文件名如“2023.6.23练习”和“2022.12.29练习”等,暗示了文件内容与特定日期相关的练习内容有关,可能是一次性的练习任务或者特定时间的打卡记录。
2023年计算机毕设选题推荐
2023年计算机毕设选题推荐计算机毕设选题是一门科学技术领域的重要组成部分,它对计算机专业学生的学习和实践产生了深远的影响。在这个时代,计算机毕设选题已经成为计算机专业学生毕业设计的核心部分之一。
2023年在线旅游平台用户洞察研究报告.docx
2023年前三季度,尽管总体出游人数还未完全恢复到2019年的水平,但五一、国庆等长假期间的出游人数已超越疫情前。


