首页 > 其他分享 >倒计时27,26天

倒计时27,26天

时间:2024-03-18 18:59:50浏览次数:24  
标签:26 27 const int long 倒计时 solve mp str

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

相关文章

  • 倒计时30,28天
    1.队列Q(nowcoder.com)//1.#include<bits/stdc++.h>usingnamespacestd;#defineintlonglongconstintN=2e5+6;constintinf=0x3f3f3f3f;intdir[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};constdoublepi=acos(-1.0);inta[N],b[N];boolcmp(intxx......
  • 代码随想录算法训练营第27天|39. 组合总和|40.组合总和II|131.分割回文串
    代码随想录算法训练营第27天|39.组合总和|40.组合总和II|131.分割回文串详细布置39.组合总和本题是集合里元素可以用无数次,那么和组合问题的差别其实仅在于startIndex上的控制题目链接/文章讲解:https://programmercarl.com/0039.%E7%BB%84%E5%90%88%E6%80%BB%E5%9......
  • 【LeetCode 2684】矩阵中移动的最大次数
    题目描述原题链接:2684矩阵中移动的最大次数解题思路每次只能向右侧的下一列紧挨着的三行严格大的格子移动;能移动到i列代表能移动i次,这取决于i-1列可到达的矩阵位置的状态,即可以整列递推相邻列是否可移动到达;两个方向递推的思路:三个(col+1)位置的状态可以逆推出一个(c......
  • 262:vue+openlayers 移动地图获取中心点经纬度信息
    第262个点击查看专栏目录本示例介绍演示如何在vue+openlayers中移动地图并获取中心点经纬度信息。这里主要用到了是view的getCenter方法,这一功能在实际项目中很有用,能给出一个清晰的定位。直接复制下面的vue+openlayers源代码,操作2分钟即可运行实现效果文......
  • 【题解】P2627 [USACO11OPEN] Mowing the Lawn G
    【题解】P2627[USACO11OPEN]MowingtheLawnG题目跳转数据量比较大,暴力肯定是不行的。只能考虑用动态规划的方式来做。这道题有许多dp设计的思路,这里提供两个:方法一:普通状态设计定义\(dp[i][1/0]\)表示截止遍历到第\(i\)个元素时,选择第\(i\)个元素或不选第\(i\)个元素可以......
  • FFmpeg-aac、h264封装flv及时间转换
    文章目录时间概念流程api核心代码时间概念dts:解码时间戳,表示压缩帧的解码时间pts:显示时间戳,表示将压缩帧解码后得到的原始帧的显示时间时间基:time_base,通常以ms为单位时间戳:timestamp,多少个时间基真实时间:time_base*timestamp如一个视频帧......
  • YC260A [ 20240317 CQYC省选模拟赛 T1 ] 伙伴(aka)
    题意给定一张无自环、重边的不连通图。让你把这个图加上一些边成为若干个环。每个节点的权值为相邻两条边为原图上的边的个数-1。求所有点的权值和最大的权值。Sol考虑拆点。集中注意力,发现连边后形成一个二分图。既然要权值最大,肯定要让原图的边留下最多。直接做最大......
  • P2746 [USACO5.3] 校园网Network of Schools 题解
    题目链接:校园网NetworkofSchools这个题得翻译下题目意思才知道在干嘛,题目一开始表明了这个是一个有向图,因为边是单向的。其次关于第一个问题:基于一个事实,如果有\(x\rightarrowy\rightarrowz\),那么只需要\(x\)接受协议,它所在的\(scc\)强连通分量上的点一定都能不需要......
  • 学习JavaEE的日子 Day27 手撕HashMap底层原理
    Day271.手撕HashMap底层原理(重点)publicclassTest01{ publicstaticvoidmain(String[]args){ // Floatfloat1=newFloat("0.0f");// Floatfloat2=newFloat("0.0f");// Floatresult=float1/float2;// System.out.println(result);/......
  • P2633 Count on a tree 题解
    题目链接:Countonatree大概可以认为是树上主席树的板子我在之前的某些题解提到了,主席树一般来说有两个基本功能:可持久化功能,可以选择回退或者新增版本。对于可差性问题,可以有更好的转化为前缀和做法,常见的问题为权值类型问题。在树上的路径第\(k\)大,显然如果我们能......