首页 > 其他分享 >AtCoder Beginner Contest 239总结

AtCoder Beginner Contest 239总结

时间:2022-12-28 09:57:33浏览次数:43  
标签:std AtCoder Task 题意 Beginner 10 int 239 include

由于比赛延期了一个星期,今天才打,恰巧我记错了时间,本来是8:00, 我记成9:00,
然后·········

幸运的是我还是把前四题做出来了 (in twenty minutes),由于时间问题,我成功的排在4000多名的地方,我可怜的rating.........

这次比赛前四道都会,后四道都知道在考什么, 我都没学过

Task 1:Horizon

题意:求 \(\sqrt{(x*(12800000 + x))}\)

solution: 直接求, Code

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
double h; 
int main(){
	cin >> h;
	printf("%.7lf", sqrt(h * (h + 12800000)));
	return 0;
}

Task 2:Integer Division

题意:求\(x \div 10\)下取整, x为long long 类型

solution:如果负数,最后一位不为零,输出x / 10 - 1, 否则输出x / 10

如果为整数,输出x / 10, 我好像想的有点多了

Code:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
ll x; 
int main(){
	cin >> x;
	int d = x % 10;
	if(x < 0){
		if(d != 0)
			cout << x / 10 - 1;
		else
			cout << x / 10;
	}
	else{
		cout << x / 10;
	}
	return 0;
}

Task 3:Knight Fork

题意:给出两个点的坐标,是否存在一个点与这两个点的距离都为根号5

solution:暴力枚举出与这两个点距离为根号5的所有点,看一下是否有相同的

Code

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
int px, py, dx, dy;
int x[8], y[8];
int fx[8], fy[8];
int xx[8] = {1, 2, 2, 1, -1, -2, -2, -1}, yy[8] = {-2, -1, 1, 2, 2, 1, -1, 2};
int main(){
	cin >> px >> py >> dx >> dy;
	for(int i = 0; i < 8; i++)
		x[i] = px + xx[i], y[i] = py + yy[i];
	for(int i = 0; i < 8; i++)
		fx[i] = dx + xx[i], fy[i] = dy + yy[i];
	for(int i = 0; i < 8; i++)
		for(int j = 0; j < 8; j++)
			if(x[i] == fx[j] && y[i] == fy[j]){
				cout << "Yes";
				return 0;
			}
	cout << "No";
	return 0;
}

Task 4:Prime Sum Game

题意:两个人玩游戏,第一个人从A-B中选一个数字,第二个人从C-D中选一个数字,若两个数字和为指数,后手胜,否则先手胜,当两人都拿出最好水平时谁会赢?

solution:由于范围只有100,暴力循环A-B,若有一种情况后手无法凑成质数,先手赢,否则后手赢

Code:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
bool isP(int x){
	if(x <= 1)return false;
	for(int i = 2; i * i <= x; i++)
		if(x % i == 0)return false;
	return true;
}
int main(){
	int a, b, c, d, p1 = 0, p2 = 0;
	cin >> a >> b >> c >> d;
	for(int i = a; i <= b; i++){
		bool f = false;
		for(int j = c; j <= d; j++){
			if(isP(i + j)){
				f = true;
				break;
			}
		}
		if(f)p2++;
		else p1++;
	}
	if(p1 != 0)
		cout << "Takahashi";
	else
		cout << "Aoki";
	return 0;
}

剩下四题就很......

Task 5:好像是树链剖分+主席树,可惜我主席树不好

Task 6:好像是连通块还是什么,我的图论真差

Task 7:还是图论QWQ......

Task 8:期望.......

总结:前四题发挥很好,后四题还是一道不会.........
回去要补一下图论和主席树了

That's All......

By the way, my poor rating rise to 199(74 for this contest)

标签:std,AtCoder,Task,题意,Beginner,10,int,239,include
From: https://www.cnblogs.com/rlc202204/p/17009466.html

相关文章

  • Atcoder Beginner Contest 244总结
    这次的Rating凉了………………这次出乎T3意料的考了交互题,虽然很简单,但卡了我好久……T4考了一个神奇的东西,我用骗分大法水了过去……一看排名发现有快3000人得了1000分......
  • Atcoder Beginner Contest 242
    由于我8点半才下课,我只好晚半个小时再打,这次还行,排名3042五道题,秒了前三道,第四道不会,第五道想出正解,结果一直不对,比完后看了一下大佬的代码恍然大悟,但是比赛早已结束...........
  • AtCoder Beginner Contest 283
    《E-Don'tIsolateElements》dp   刚开始拿到这道题时,我总是在想:第一行翻不翻转对下面情况的影响,在什么情况下要反转,等一系列情况最后我发现:这些情况不如我可......
  • Atcoder Beginner Contest ABC 283 Ex Popcount Sum 题解 (类欧几里得算法)
    题目链接令\(p=\lfloor\frac{n-r}m\rfloor\),则我们其实是要对所有\(0\lei\le29\)求\(\sum_{j=0}^p(\lfloor\frac{mj+r}{2^i}\rfloormod\2)\)。右边那个东西如果没......
  • AtCoder Grand Contest 060(持续更新)
    Preface那一天,闪总终于想起了被ACG支配的恐惧……只能说还好Rating不够,这场Unrated打的,写了个A然后B一直挂(一个细节没想到),C数数又数不来90min后光速跑路推Gal去了A-......
  • AtCoder Beginner Contest 283(A~F)
    Aa,b=map(int,input().split())print(pow(a,b))Bn=int(input())a=list(map(int,input().split()))q=int(input())foriinrange(q):op=list(map(int,input()......
  • 「杂题乱写」AtCoderDP26 题
    「杂题乱写」AtCoderDP26题\(\text{AtCoderDP26}\)题题单。前言最近听说\(\text{AtCoder}\)上有个\(\text{DP26}\)题挺好的,于是向@\(\text{SoyTony}\)要了题单......
  • AtCoder Beginner Contest 283
    A-Power(abc283a)题目大意给定\(A,B\),输出\(A^B\)解题思路数不大,暴力即可。数大了可用快速幂。神奇的代码#include<bits/stdc++.h>usingnamespacestd;us......
  • atcoder
    AGC001D题目大意:有一个长度为\(m\)的序列\(a\),它的和为\(n\),需要将\(a\)重排,并构造一个任意长度但和为\(n\)的序列\(b\),使得对任意长度为\(n\)的字符串,如果......
  • [翻译]写给初学者的源代码安装指南Beginner's Guide to Installing from Source
    写给初学者的源代码安装指南引入本文档面向希望直接从原始作者处安装软件的开源操作系统用户,而不是仅依赖其操作系统提供的软件(和版本)。它是为那些不熟悉以源代码形式下......