Ericnth的小站

  • 你可能还想了解...
  • 首页
  • 编程学习笔记
  • 系统与软件
  • 摄影
  • 随笔
  • 论坛
  • 公告

洛谷 8 月月赛 div1 & div2 赛后总结

  • Zhang, Xuheng
  • 2020-08-09
  • 0

先看结果。

Div1:

其实应该是388名,因为很多人都是1分。

Div2:

Div2总结:

T1

一开始用了ull直接算,结果20pts。感谢@23786提供的字符串思路。

然后就用了字符串做,92pts。

然后又加了一个特判,小的数直接算。AC。

大概卡了20min

考场代码:

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull k,x;
char stringg[100000005];
int main()
{
	cin>>k>>x;
	if (k==1) {
		cout<<(ull)10+x;
		return 0;
	}
	if (k<=18) {
		cout<<(ull)pow(10,k)+x;
		return 0;
	}
	stringg[0] = '1';
	for (int i=1;i<=k;i++) 
	{
        stringg[i] = '0';
    }
    int i = k;
    while(x != 0)
	{
		stringg[i--]+=x%10;
        x/=10;
	}
	for (int i=0;i<=k;i++) cout<<stringg[i];
	return 0;
}


T2

这题我和786一人一个subtask搞到了60pts,然后最后一行直接蒙了一个。就AC了。

感觉这道题没什么意思。

考场代码:

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a,b,c,d;
int main()
{
	cin>>a>>b>>c>>d;
	if (a==0 && b==0) {
		cout<<0;
		return 0;
	}
	
	if (a==b) {
		printf("%d",c>2*d?2*d:c);
		return 0;
	}
	
	if (a==0||b==0) {
		cout<<d;
		return 0;
	}
	
	if (c==1) {
		cout<<(ull)c+d;
		return 0;
	}
	printf("%d",d*2>d+c?d+c:d*2);
	return 0;
}

看起来都不像AC代码。

T3

没什么思路,只能骗分。结果没骗到,0pts。

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int n;
ull a[100005];
int q;
ull m[100005];
int main() {
	cin>>n;
	for (int i=1;i<=n;i++) {
		cin>>a[i];
	}
	cin>>q;
	for (int j=1;j<=q;j++) {
		cin>>m[j];
	}
	if (n==1) {
		cout<<m[1];
		return 0;
	}
	else {
		for (int i=1;i<=q;i++) {
			cout<<-1<<endl;
		}
	}
	return 0;
}

T4

看了数据范围,我神奇般的骗到了1分。

代码:

#include <bits/stdc++.h>
using namespace std;
int n,m;
int main()
{
	cin>>n>>m;
	if (m==1) {
		cout<<n-1;
	}
	return 0;
}

over。

这次月赛打满了4h,成绩还ok。但还是很弱。。。。。。

你可能还想了解...

  • 洛谷 10 月月赛 II 赛后总结
  • 洛谷10月月赛 I 赛后总结
  • 洛谷8月月赛官方题解
  • [LGR-073]Div2 游记
© 2023 Ericnth的小站
Theme by Wing
沪ICP备2020025694号 沪公网安备31011202012861号
  • {{ item.name }}
  • {{ item.name }}