首页 > 其他分享 >【若归】 【LGR-142-Div.4】洛谷入门赛 #13赛后反思

【若归】 【LGR-142-Div.4】洛谷入门赛 #13赛后反思

时间:2023-06-09 21:55:59浏览次数:56  
标签:std 13 洛谷 int ans2 long LGR using include

比赛链接:【LGR-142-Div.4】洛谷入门赛 #13


rk288,比前几次差(可能是因为rated?)

A 十年OI一场空,不开long long见祖宗

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n;
	cin>>n;
	cout<<"8 "<<12*(n-2)<<" "<<6*(n-2)*(n-2);
	return 0;
}

打完A去吃了个饭,回来都7点半了(祭)

B

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b,c,ans;
	cin>>n>>a>>b>>c;
	if(n<=3)
	{
		if(a<min(b,c))
		{
			ans=a;
		}
		else
		{
			if(b<min(a,c))
			{
				ans=b;
			}
			else
			{
				ans=c;
			}
		}
	}
	else
	{
		if(n<=5)
		{
			if(b<c)
			{
				ans=b;
			}
			else
			{
				ans=c;
			}
		}
		else
		{
			if(n<=9)
			{
				ans=c;
			}
		}
	}
	if(ans==a)
	{
		cout<<"library";
	}
	if(ans==b)
	{
		cout<<"comprehensive";
	}
	if(ans==c)
	{
		cout<<"art";
	}
	return 0;
}

C 十年OI一场空,不开long long见祖宗

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,x,i,ans,a;
	cin>>n>>x;
	ans=n*x;
	for(i=1;i<=n;i++)
	{
		cin>>a;
		ans+=a;
	}
	cout<<ans;
	return 0;
}

D 忘记了对s2==0的特判,以为卡long long,然后就用上了int128,20min没了(祭)

#include<bits/stdc++.h>
using namespace std;
#define ll __int128_t
ll read()
{
    ll x=0,f=1;
    char c=getchar();
    while(c>'9'||c<'0')
    {
        if(c=='-')
        {
            f=-1;
        }
        c=getchar();
    }
    while('0'<=c&&c<='9')
    {
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
void write(ll x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
    {
        write(x/10);
    }
    putchar((x%10)+'0');
}
int main()
{
	ll n,m,i,ans=0,a,b,c,s1,s2;
	n=read();
	m=read();
	for(i=1;i<=n;i++)
	{
		a=read();
		b=read();
		c=read();
		ans+=(a*b*c);
	}
	s1=ans/m;
	s2=ans%m;
	if(s2!=0)
	{
		s1++;
	}
	write(s1);
	cout<<" ";
	if(s2==0)//一定要特判,别想起来上边的不记得这个
	{
		write(m);
	}
	else
	{
		write(s2);
	}	
	return 0;
}

E 关于我把a b写反了这件事,调了40min(警钟长鸣)

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,x,y,a,b,S,s,m,i,sum=0,num=0,ans1=0,ans2=0;
	cin>>n>>x>>y>>a>>b;
	for(i=1;i<=n;i++)
	{
		cin>>S>>s>>m;
		if(S*x+s*y==m)
		{
			num=0;
			sum++;
			if(sum>=b)
			{
				ans2/=2;
			}
			ans1=max(ans1,ans2);
		}
		if(S*x+s*y<m)
		{
			sum=0;
			num++;
			ans2+=(m-S*x-s*y);
			if(m-S*x-s*y>S*x+s*y)
			{
				ans2+=(m-S*x-s*y)/2;
				if((m-S*x-s*y)%2==1)
				{
					ans2++;
				}
			}
			if(num>=a)
			{
				ans2*=2;
			}
			ans1=max(ans1,ans2);
		}
	}
	cout<<ans1<<" "<<ans2;
	return 0;
}

F 看起来很难的样子,没写

G 看起来很难的样子,没写

H 看起来很难的样子,没写

I 还行,一开始想把它整RE,结果忘记了luogu检测不出来RE(总结,极限数据是个好东西)

#include <iostream>

using namespace std;

int main() {
  int taskId;
  cin >> taskId;
  if (taskId == 1) {
    cout << "99 1 99" <<endl;
  } else if (taskId == 2) {
    cout<<"200000\n";
    for(int i=1;i<=200000;i++)
    {
      cout<<"std::cerr"<<endl;
    }
  } 
}

I 彩蛋:我是谁,我在哪里

感觉稍微有点思维难度的就做不出来了,whk考试的习惯(发慌)又双叒叕延续到OI上来了。

标签:std,13,洛谷,int,ans2,long,LGR,using,include
From: https://www.cnblogs.com/The-Shadow-Dragon/p/17470330.html

相关文章

  • jenkins中的坑_CreateProcess error=1392
    环境:windows11,jdk1.8,jenkins_2.346.war起因最近在使用jenkins部署项目的时候,填写仓库的url地址时,发现填完后报500这个错误,于是我打开jenkins的控制台,发现了这个报错,***java.io.IOException:CreateProcesserror=1392,文件或目录损坏且无法读取。***我就把这个错误信息去百度......
  • 13) Proxy Pattern
    类别: StructuralPattern问题:操纵一个对象时碍手碍脚,与装饰者模式不同之处:装饰者是接口方法,授权小代理则是整个类,授权大方案:   示例: publicclassProxyPatternDemo{publicstaticvoidmain(finalString[]arguments){finalImageimage......
  • 【每日一题】Problem 313B - Ilya and Queries
    原题解决思路使用后缀和计算到i处共有多少对\(s_i=s_{i+1}\),计算时相减以下就可以#include<bits/stdc++.h>intmain(){std::strings;intm;std::cin>>s>>m;std::vector<std::vector<int>>vec(m,std::vector<int>(2,0));......
  • ARC132E
    https://www.luogu.com.cn/problem/AT_arc132_e由于一旦走到头那么这一个后缀/前缀就一定是对应的颜色,所以最终答案形如一段左脚印,一段保留原来的,一段右脚印。保留原来的段一定是在两个洞之间的一段完整段,考虑枚举这个段,左脚印的数量是确定的,转化成算概率的问题。这实际上等价......
  • CF1338 Div.1 做题记录
    ACF题面假定用到的最大的数是\(x\),那么一个数最大可以增大\(2^x-1\)。题目只要求不降,所以求出将\(a_i<a_{i-1}\)变成\(a_i=a_{i-1}\)时需要增大的最大值。求出这个数的二进制位数即可。点击查看代码#include<bits/stdc++.h>#defineullunsignedlonglong#definell......
  • LightOJ - 1374 Confusion in the Problemset (模拟)
    TimeLimit: 2000MSMemoryLimit: 32768KB64bitIOFormat: %lld&%lluLightOJ-1374ConfusionintheProblemsetSubmit StatusDescriptionAsmallconfusioninaproblemsetmayruinthewholecontest.So,mostoftheproblemsetterstrytheirbesttorem......
  • 1113.DRF
    一、路由器1.SimpleRouter该路由器包括标准集合:list,create,retrieve,update,partial_update和destroy动作的路由。视图集中还可以使用@detail_route或@list_route装饰器标记要被路由的其他方法。2.DefaultRouter这个路由器类似于上面的SimpleRouter,但是还包括一个默认返回所有......
  • [LeetCode] 1351. Count Negative Numbers in a Sorted Matrix
    Givena mxn matrix grid whichissortedinnon-increasingorderbothrow-wiseandcolumn-wise,return thenumberof negative numbersin grid.Example1:Input:grid=[[4,3,2,-1],[3,2,1,-1],[1,1,-1,-2],[-1,-1,-2,-3]]Output:8Explanation:Thereare......
  • 2013年工作中遇到的20个问题:121-140
     121.Springz中,根据实现类找不到bean。UserImplimplementsUser{}XmlWebApplicationContextcontext;context.getBean(User.class);√javcontext.getBean(UserImpl.class);获取不到  没有使用Cgilib库!  --------貌似也不行------------ 因为spring的......
  • 2013年工作中遇到的20个问题(Bug):161-180
    161.用户表和超级用户分成2个表,很不合理,查询的时候,非常复杂。162.leftjoin还是很有“市场”的。机构表Org连接User时,想获得user的名字,可能存在,也可能不存在,leftjoin就适合。##多个leftjoin之间不能使用","隔开selectcg.*,u.loginNamecreatorName,org.nativeNameadvertiser......