A-S 老师的公式_牛客挑战赛73 (nowcoder.com)
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e8+6;
const int inf=0x3f3f3f3f;
int dir1[8][2]={{0,1},{0,-1},{-1,0},{1,0},{1,1},{-1,-1},{1,-1},{-1,1}};
int dir2[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int dp[N];
//round(a)
//int a=strtoll(s.c_str(),NULL,10);
void solve()
{
int n;cin>>n;
int cn=n*(n+1)/2,hhh=1;
for(int i=1;i<=n;i++)
{
int r=__gcd(cn,i);
cn/=r,hhh*=r;
}
cout<<hhh;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
2.B-S 老师的签到_牛客挑战赛73 (nowcoder.com)
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e3+6;
const int inf=0x3f3f3f3f;
int dir1[8][2]={{0,1},{0,-1},{-1,0},{1,0},{1,1},{-1,-1},{1,-1},{-1,1}};
int dir2[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int dp[N];
string s[N];
//round(a)
//int a=strtoll(s.c_str(),NULL,10);
void solve()
{
int n,m;cin>>n>>m;
char c;string s[N];
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>c;
if(i==1)s[j]=s[j-1]+c;
else if(j==1)s[j]=s[j]+c;
else s[j]=min(s[j],s[j-1])+c;
}
}
cout<<s[m];
}
signed main()
{
//ios_base::sync_with_stdio(false);
//cin.tie(0),cout.tie(0);
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
3.L1-035 情人节 - 2024团体程序设计天梯赛(历年真题)练习集 (pintia.cn)
//printf输出时要注意:string类型printf输出要在之后加.c_str();
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
map<int,string>mp;
void solve()
{
string s;
int cn=0;
mp[2]="0",mp[14]="0";
while(cin>>s&&s!=".")
{
cn++;
mp[cn]=s;
}
if(mp[2]!="0"&&mp[14]!="0")
{
printf("%s and %s are inviting you to dinner...",mp[2].c_str(),mp[14].c_str());
}
else if(mp[2]!="0")
{
printf("%s is the only one for you...",mp[2].c_str());
}
else printf("Momo... No one is for you ...");
}
signed main()
{
//ios_base::sync_with_stdio(false);
//cin.tie(nullptr),cout.tie(nullptr);
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+6;
const int inf=0x3f3f3f3f;
void solve()
{
string s;cin>>s;
int a=strtoll(s.c_str(),NULL,10);
double aa=3.555;
cout<<round(aa*100.0)/100.0<<endl<<a<<endl;
printf("%s",s.c_str());
}
signed main()
{
ios_base::sync_with_stdio(false);
//cin.tie(nullptr),cout.tie(nullptr);
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
标签:26,27,const,int,long,倒计时,solve,mp,str
From: https://blog.csdn.net/fkuelntxgt/article/details/136790587