第一次完整的做一场codeforces !!!!!!(Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Sha)

windows 下AD9361的 no-os master 工程搭建 参考网站: https://wiki.analog.com/resources/fpga/docs/build#windows_environment_setup https://wiki.analog.com/resources/eval/user-guides/ad-fmcomms2-ebz/software/no-os-setup 参考博客: https://blog.csdn.net... 阅读详情
A. Game
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Two players play a game.

Initially there are nn integers a1,a2,…,ana1,a2,…,an written on the board. Each turn a player selects one number and erases it from the board. This continues until there is only one number left on the board, i. e. n−1n−1 turns are made. The first player makes the first move, then players alternate turns.

The first player wants to minimize the last number that would be left on the board, while the second player wants to maximize it.

You want to know what number will be left on the board after n−1n−1 turns if both players make optimal moves.

Input

The first line contains one integer nn (1≤n≤10001≤n≤1000) — the number of numbers on the board.

The second line contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤1061≤ai≤106).

Output

Print one number that will be left on the board.

Examples
input
Copy
3
2 1 3
output
Copy
2
input
Copy
3
2 2 2
output
Copy
2
Note

In the first sample, the first player erases 33 and the second erases 11. 22 is left on the board.

In the second sample, 22 is left on the board regardless of the actions of the players.

#include<bits/stdc++.h>
using namespace std;
int main()
{
		int n;
				int a[1005];
		cin>>n;
		memset(a,0,sizeof(a));

		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		sort(a,a+n);
		if(n%2==0)
		cout<<a[n/2-1]<<endl;
		else
		cout<<a[n/2]<<endl;
	return 0;
}

B. Minesweeper
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he rarely won.

Alex has grown up since then, so he easily wins the most difficult levels. This quickly bored him, and he thought: what if the computer gave him invalid fields in the childhood and Alex could not win because of it?

He needs your help to check it.

A Minesweeper field is a rectangle n×mn×m, where each cell is either empty, or contains a digit from 11 to 88, or a bomb. The field is valid if for each cell:

  • if there is a digit kk in the cell, then exactly kk neighboring cells have bombs.
  • if the cell is empty, then all neighboring cells have no bombs.

Two cells are neighbors if they have a common side or a corner (i. e. a cell has at most 88 neighboring cells).

Input

The first line contains two integers nn and mm (1≤n,m≤1001≤n,m≤100) — the sizes of the field.

The next nn lines contain the description of the field. Each line contains mm characters, each of them is "." (if this cell is empty), "*" (if there is bomb in this cell), or a digit from 11 to 88, inclusive.

Output

Print "YES", if the field is valid and "NO" otherwise.

You can choose the case (lower or upper) for each letter arbitrarily.

Examples
input
Copy
3 3
111
1*1
111
output
Copy
YES
input
Copy
2 4
*.*.
1211
output
Copy
NO
Note

In the second example the answer is "NO" because, if the positions of the bombs are preserved, the first line of the field should be *2*1.

You can read more about Minesweeper in Wikipedia's article.

#include<bits/stdc++.h>
using namespace std;
int main()
{
	char mp[200][200];
	int n,m;
	int mp1[200][200];
	int mp2[200][200];
	cin>>n>>m;
	{
		memset(mp1,0,sizeof(mp1));
		memset(mp2,0,sizeof(mp2));
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				cin>>mp[i][j];
				if(mp[i][j]=='*')
				{
					mp1[i][j]=-9999;
					mp2[i][j]=-9999;
					mp1[i+1][j]+=1;
					mp1[i+1][j+1]+=1;
					mp1[i-1][j]+=1;
					mp1[i-1][j-1]+=1;
					mp1[i][j-1]+=1;
					mp1[i][j+1]+=1;
					mp1[i+1][j-1]+=1;
					mp1[i-1][j+1]+=1;

				}
				else if(mp[i][j]=='.')
				{
					mp2[i][j]=0;
				}
				else
				{
					mp2[i][j]+=mp[i][j]-'0';
				}
			}
		}
				for(int i=1;i<=n;i++){
					for(int j=1;j<=m;j++){
						if(mp1[i][j]>=0&&mp2[i][j]>=0){
							if(mp1[i][j]!=mp2[i][j])
							{
								cout<<"NO"<<endl;
								return 0;
							}
						}
					}
				}
				cout<<"YES"<<endl;
	}
return 0;
}
C. Finite or not?
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given several queries. Each query consists of three integers pp, qq and bb. You need to answer whether the result of p/qp/q in notation with base bb is a finite fraction.

A fraction in notation with base bb is finite if it contains finite number of numerals after the decimal point. It is also possible that a fraction has zero numerals after the decimal point.

Input

The first line contains a single integer nn (1≤n≤1051≤n≤105) — the number of queries.

Next nn lines contain queries, one per line. Each line contains three integers pp, qq, and bb (0≤p≤10180≤p≤1018, 1≤q≤10181≤q≤1018, 2≤b≤10182≤b≤1018). All numbers are given in notation with base 1010.

Output

For each question, in a separate line, print Finite if the fraction is finite and Infinite otherwise.

Examples
input
Copy
2
6 12 10
4 3 10
output
Copy
Finite
Infinite
input
Copy
4
1 1 2
9 36 2
4 12 3
3 5 4
output
Copy
Finite
Finite
Finite
Infinite
Note

612=12=0,510612=12=0,510

43=1,(3)1043=1,(3)10

936=14=0,012936=14=0,012

412=13=0,13412=13=0,13

#include<bits/stdc++.h>
#define _max 5000
using namespace std;
long long gcd(long long a,long long b){
	return b==0?a:gcd(b,a%b);
}
int main(){
	ios::sync_with_stdio(false);//这个会提高速度,不加会tl
	int n;
	cin>>n;
	while(n--){
		long long p,q,b;
		cin>>p>>q>>b;
		long long g=gcd(p,q);
		q/=g;
		b=gcd(q,b);
		while(b!=1){
			while(q%b==0)q/=b;
			b=gcd(q,b);
		}
		if(q==1) cout<<"Finite"<<endl;
		else cout<<"Infinite"<<endl;
	}
}

D. XOR-pyramid
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

For an array bb of length mm we define the function ff as

f(b)={b[1]if m=1f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])otherwise,f(b)={b[1]if m=1f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])otherwise,

where ⊕⊕ is bitwise exclusive OR.

For example, f(1,2,4,8)=f(1⊕2,2⊕4,4⊕8)=f(3,6,12)=f(3⊕6,6⊕12)=f(5,10)=f(5⊕10)=f(15)=15f(1,2,4,8)=f(1⊕2,2⊕4,4⊕8)=f(3,6,12)=f(3⊕6,6⊕12)=f(5,10)=f(5⊕10)=f(15)=15

You are given an array aa and a few queries. Each query is represented as two integers ll and rr. The answer is the maximum value of ffon all continuous subsegments of the array al,al+1,…,aral,al+1,…,ar.

Input

The first line contains a single integer nn (1≤n≤50001≤n≤5000) — the length of aa.

The second line contains nn integers a1,a2,…,ana1,a2,…,an (0≤ai≤230−10≤ai≤230−1) — the elements of the array.

The third line contains a single integer qq (1≤q≤1000001≤q≤100000) — the number of queries.

Each of the next qq lines contains a query represented as two integers ll, rr (1≤l≤r≤n1≤l≤r≤n).

Output

Print qq lines — the answers for the queries.

Examples
input
Copy
3
8 4 1
2
2 3
1 2
output
Copy
5
12
input
Copy
6
1 2 4 8 16 32
4
1 6
2 5
3 4
1 2
output
Copy
60
30
12
3
Note

In first sample in both queries the maximum value of the function is reached on the subsegment that is equal to the whole segment.

In second sample, optimal segment for first query are [3,6][3,6], for second query — [2,5][2,5], for third — [3,4][3,4], for fourth — [1,2][1,2].



#include<bits/stdc++.h>
#define _max 5000
using namespace std;
int a[_max],dp[_max][_max],ans[_max][_max];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
		dp[i][i]=a[i];
		ans[i][i]=a[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j+i<=n;j++){
			int t=i+j;
			dp[j][t]=dp[j+1][t]^dp[j][t-1];
			ans[j][t]=max(dp[j][t],max(ans[j+1][t],ans[j][t-1]));
		}
	}
	int q;
	cin>>q;
	while(q--){
		int l,r;
		cin>>l>>r;
		cout<<ans[l][r]<<endl;
	}
	return 0;
}
E. Elevator
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.

Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you know the order in which people came to the elevator.

According to the company's rules, if an employee comes to the elevator earlier than another one, he has to enter the elevator earlier too (even if these employees stay on different floors). Note that the employees are allowed to leave the elevator in arbitrary order.

The elevator has two commands:

  • Go up or down one floor. The movement takes 1 second.
  • Open the doors on the current floor. During this operation all the employees who have reached their destination get out of the elevator. Then all the employees on the floor get in the elevator in the order they are queued up while it doesn't contradict the company's rules and there is enough space in the elevator. Each employee spends 1 second to get inside and outside the elevator.

Initially the elevator is empty and is located on the floor 1.

You are interested what is the minimum possible time you need to spend to deliver all the employees to their destination. It is not necessary to return the elevator to the floor 1.

Input

The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees.

The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach.

The employees are given in the order they came to the elevator.

Output

Print a single integer — the minimal possible time in seconds.

Examples
input
Copy
2
3 5
5 3
output
Copy
10
input
Copy
2
5 3
3 5
output
Copy
12
Note

正在解决


【数据结构】平行四边形数量 平行四边形个数,哈希表,散列 阅读详情

相关推荐

保姆级教程:用sw_urdf_exporter插件将Solidworks机械臂模型转为ROS可用的URDF

本文提供了一份详细的保姆级教程,指导用户使用sw_urdf_exporter插件将Solidworks机械臂模型转换为ROS可用的URDF文件。从环境准备、插件配置到模型预处理和关键参数设置,再到ROS环境集成测试和性能优化,全面覆盖了机械臂URDF转换的全流程。特别适合机器人工程师和ROS开发者快速实现Solidworks模型到ROS环境的无缝迁移。

weixin_29300931的博客 401

codeforce---------Game

Two players play a game. Initially there are nn integers a1,a2,…,ana1,a2,…,an written on the board. Each turn a player selects one number and erases it from the board. This continues until there is on...

qq_45772483的博客 439

Win10 LTSC 2021 CPU占用率飙升?KB5017308补丁修复全攻略

本文针对Windows 10 LTSC 2021系统中因wsappx进程导致的CPU占用率异常飙升问题,提供了详细的解决方案。核心在于安装微软官方发布的KB5017308补丁,该补丁能从根本上修复系统组件缺陷,使CPU占用恢复正常。文章详解了补丁的下载、安装步骤、注意事项及安装后的验证方法,是解决此问题的权威指南。

python9snake的博客 1272

Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Shaburov!]

题目链接:http://codeforces.com/contest/984 A. Game time limit per test:2 seconds memory limit per test:512 megabytes input:standard input output:standard output Two pl...

di6499的博客 243

UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount()【已解决】

UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount()【已解决】

围炉夜敲的博客 1万+

STM32外部中断EXTI原理与飞控实时应用实战

外部中断(EXTI)是嵌入式系统中实现事件驱动和实时响应的核心机制,其本质是将外部电平变化转化为可调度的CPU中断事件。基于ARM Cortex-M NVIC架构,EXTI通过GPIO-EXTI-NVIC三级硬件通路实现低延迟信号捕获,具备边沿触发、优先级管理与挂起控制等关键能力。在四轴飞控、工业传感器、人机交互等对毫秒级响应有强需求的场景中,EXTI显著优于轮询方式,兼顾实时性与CPU资源效率。实际开发需严格遵循SYSCFG映射→EXTI配置→NVIC使能的时序逻辑,并规避常见陷阱如中断号误配、伪触发、低

weixin_36382073的博客 66

Codeforces Round #483 [Thanks, Botan Investments and Victor Shaburov!] Editoral

T1:A. Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo players play a game.Initially there are nn integers a1,a2,…,ana1,a2,…,an written on ...

howell 448

库存优化技术提升电商效率

第一部分:库存优化技术基础 第1章:库存优化的基本概念 库存优化是现代电商运营中至关重要的一个环节。简单来说,库存优化指的是通过一系列的策略和技术手段,使得库存管理更加高效、准确,从而降低运营成本,提高销售额。 1.1 库存优化的定义与重要性

AI天才研究院 1248

Codeforces-984B - Minesweeper - 暴力

题解链接: https://lucien.ink/archives/210/ 题目链接: http://codeforces.com/contest/984/problem/B 题目: One day Alex decided to remember childhood when computers were not too powerful and lots of people...

LucienShui 987

知识图谱设计简记

知识图谱是一种语义化的知识表示框架,通过实体-关系-属性三元组形式表达现实世界关联。其核心价值在于关联化整合数据、支持可解释性推理和赋能智能化应用。知识图谱可分为通用型和领域型两类,基本构成包括实体、关系、属性等基础元素,以及本体和实例等架构层元素。设计方法主要有自上而下、自下而上和混合式三种,需遵循业务导向、一致性等原则。在建模时需要明确属性与实体的判断标准,规范处理关系的方向性与对称性,并合理构建多重关系。主流技术框架如RDF和属性图体系均支持多重关系建模,选择需考虑业务需求。本体作为知识图谱的概念骨架

生活在别处 363

【GameFramework框架】7-2、GameFramework框架是否“过度设计”?

框架是否过度设计,这个问题其实我被问到很多次了。不仅仅是新手刚接触就觉得“过度设计”的评价,有些熟练的开发者也会有这种感觉。那么,这篇文章就来探究一下,为什么框架会让人感觉“过度设计”,以及框架如何设计,还有,如何让框架适应自己的节奏。

优快云博客专家,Unity3D高级软件工程师,《Unity 3D从入门到实战》作者。 2120

Codeforces-984A - Game - 思维

题解链接: https://lucien.ink/archives/209/ 题目链接: http://codeforces.com/contest/984/problem/A 题目: Two players play a game. Initially there are n integers a1,a2,…,ana1,a2,…,ana_1,a_2,…,a_n written...

LucienShui 819

uniapp - 解决苹果ios真机运行报错:错误:请查看是否设备未加入到证书列表或者确认证书类型是否匹配(HbuilderX运行IOS手机出现问题,uniapp运行到IOS真机提示请查看是否设备未)

uni-app,ios苹果,App平台端,uniapp运行到IOS真机提示错误:请查看是否设备未加入到证书列表或者确认证书类型是否匹配,UUID在哪里,uniApp运行到ios真机报错解决,安装自定义基座App失败,没找到有计划资源,证书、标识符和描述文件,证书标识符和描述文件下面没有选项怎么回事,HBuilder真机调试报错请查看是否设备未加入到证书列表或者确认证书类型是否匹配,UniApp运行到IOS真机提示,授权的设备才可以直接安装基座,添加调试的IOS设备,在Devices中,添加手机设备UUID

🏆 前端领域优质创作者 1万+

Codeforces Round #483 (Div. 1) [Thanks, Botan Investments and Victor Shaburov!] C. Elevator(dp)

题目链接:http://codeforces.com/contest/983/problem/C按照题解的dp写的,关键点在于,每次电梯接人的时候,电梯里最多有3个人,所以,只用记录三个人想去那几个楼层,记忆化搜索一下就好了。貌似在这个状态挺难设计的啊?代码:#include&lt;bits/stdc++.h&gt; #define pb push_back using namespace std...

bibibibi的博客 304

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Codeforces Round #483 (Div. 1) [Thanks, Botan Investments and Victor Shaburov!] A. Finite or not?

题目大意 给出一个在101010进制中分数pq\frac{p}{q}qp​,问其在bbb进制下,是否是有限小数。 时间限制 1s 数据范围 p,q,b≤1018p,q,b\le 10^{18}p,q,b≤1018 题解 先考虑在101010进制下,如何判断一个分数是否为有限小数。 先对pq\frac{p}{q}qp​进行约分,得到最简分数,此时ppp已经毫无意义了。 如果∃x\exist x∃x使得q∣10xq|10^xq∣10x那么就是有限小数了。 但是,这个xxx并不好找,而且如此大的数运算起来也是非常

lijf2001的博客 176

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Codeforces Round #483 (Div. 2)题解

A. Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Two players play a game. Initially there arennintegersa...

weixin_30851409的博客 433

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

【AtCoder ABC 075 B】Minesweeper

【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 模拟,把#换成1 八个方向加一下就好。 【代码】 #include <bits/stdc++.h> using namespace std; const int N = 50; const int dx[8] = { 1,1,1,0,0,-1,-...

weixin_30651273的博客 240

#483(div.2) B. Minesweeper

题目地址:http://codeforces.com/contest/984/problem/B题目:One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Mi...

做题记录 559

984B. Minesweeper

B. Minesweepertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Alex decided to remember childhood when computers were not too powerful and l...

memory_qianxiao的博客 740

CF984B Minesweeper

原题链接:http://codeforces.com/contest/984/problem/B Minesweeper One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjo...

ShadyPi的IT笔记 357

sgu-239 Minesweeper

题目大意:给你一个2∗N2*N的扫雷棋盘,我们假设是22列NN行(反正无所谓),摈并且第11列没有雷,然后题目已经告诉你第一列的格子点开后中间的数字。然后要你求第二列有多少种布雷的方案。解题思路:首先你得会玩扫雷。。(不会的出门左转阳台不送) 然后我们观察可以发现,如果我们确定了第22列第11行,那么我们就可以推出所有的雷了,所以我们只需要枚举一下第22列第11行是否有雷就行了,时间复杂度O(N)

zzj的专栏 832

A. Game

Two players play a game. Initially there are nn integers a1,a2,…,ana1,a2,…,an written on the board. Each turn a player selects one number and erases it from the board. This continues until there is on...

人间烟火气,最抚凡人心 427

CodeForces - 813C(最短路径水题)

The Tag Game  Alice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vertices.

OttsWang的博客 785

Problem B: Minesweeper

UVA一道简单的编程题,,关于扫雷的,居然出错,郁闷了一下,自己试明明是对的 Have you ever played Minesweeper? It's a cute little game which comes within a certain Operating System which name we can't really remember. Well, the

Backer 890

TYUT-codeforce-----Minesweeper

Minesweeper One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that h...

weixin_45855809的博客 304

Codeforces Round #483 (Div. 2) B. Minesweeper

B. Minesweepertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Alex decided to remember childhood when computers were not too powerful and l...

恒持此志成永志 375
上一篇: kuangbin专题二 搜索进阶 A - Eight
下一篇: kuangbin专题二 搜索进阶 I - A计划
Unclebighead
博客等级 码龄9年 3粉丝 65原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值