A.围栏
#include <iostream>
using namespace std;
int main(){
long long n, ans = 0;cin>>n;
for(long long i = 1; i <= n; ++i){
long long tmp = (n + i - 1) / i;
if (tmp < i) break;
ans = max(ans, (i + tmp) * 2);
}cout<<ans<<endl;
return 0;
}
B.解密
#include <iostream>
#include <cstdio>
using namespace std;
string solve(string a){
int len = a.length();
int mid = (len + 1) / 2;
if (len <= 2) return a;
string str1(a, 1, mid - 1), str2(a, mid, len - mid), str3(a, 0, 1);
return solve(str1) + str3 + solve(str2);
}
int main(){
string a;cin>>a;
cout<<solve(a)<<endl;
return 0;
}
标签:string,int,namespace,len,期末,long,2023,include,程设
From: https://www.cnblogs.com/w-official/p/18178947