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

Hello, 欢迎登录 or 注册!

/ 1评 / 0

本文作者:  本文分类:Luogu 游记  浏览:972
阅读时间:1274字, 约1.5-2分钟

先看结果。

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。但还是很弱。。。。。。

关于作者

  1. EricNTH说道:

    2020-08-29 11:05审核通过

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注