The 2021 ICPC Asia Regionals Online Contest (II)
比赛链接
The 2021 ICPC Asia Regionals Online Contest (II)
G Limit
Description
Given integers, , and an integer t. You need to calculate:
.
Input
The first line consists of two integers n,t.
In the following n lines, the i-th line consists of two integers .
Output
Please output the result of this limit. If the result is , please output "infinity" (without quotes). And if the result is an integer, please output this integer directly. Otherwise, the answer must be , such that a and b are coprime and , please output "a/b".
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
Sample Input 3
Sample Output 3
解题思路
洛必达法则
根据 值,运用洛必达法则,即:分子为0时可以使用洛必达公式,否则答案为infinity
,具体如下:t
- 时间复杂度:
泰勒展开
直接对 进行泰勒展开、变形即可,如下:
依上,对于 ,我们先枚举 ,如果第二重循环的和非0,即 , 趋于 ,则答案为infinity
,否则 时必有答案
- 时间复杂度:
代码
- 洛必达
- 泰勒公式
L Euler Function
Description
The Euler function, , is known to be important in math theory. Given a positive integer , is defined as the number of integers in that are co-prime with . For example, .
Now, given an array with positive integers $x_1,…,x_n, your task is to maintain operations on , which can be categorized into two types:
-
, for each index , change x_i to .
-
, calculate and print.
Input
The first line contains two inetegers .
The second line contains integers .
Then lines follow. The -th line describes the -th operation. The input guarantees that and .
Output
For each operation of type , output a single line with a single integer, representing the answer.
Sample Input
Sample Output
解题思路
- 时间复杂度:
代码
M Addition
Description
The numbers in the computer are usually stored in binary form. But in Little A's computer, the numbers are stored in a different way.
The computer uses n bits to store a number. The value it stores is
, where is an array of length containing only and , and is a predefined array of length containing only and . It is not difficult to find that every expressible integer has a unique expression.
Little A gives you the binary representation of and in his computer, and you should report the binary representation of in his computer. It is guaranteed that
, and all integers in can be expressed in his computer.
Input
The first line contains an integer , which represents the number of bits used to store an integer.
The second line contains integers, and the -th of them represents .
The third line contains integers, and the -th of them represents . The value of a is .
The fourth line contains integers, and the -th of them represents $vb_{i−1}. The value of is .
It is guaranteed that , and .
Output
Output one line containing integers, separated by spaces. The -th of them represents . There should be no extra spaces at the end of the line.
You should guarantee that .
Your output must be in a single line.
Sample Input
Sample Output
解题思路
模拟二进制加法
与二进制不同的是,本题多了每位的符号位,关键在于处理进位,当当前位与后一位符号位相同时,后一位加上的正是进位,否则是进位的相反数,由于一开始的进位 ,对下一位的进位只能是 ,即:,故: 最小是 (即需借位),最大是 ,分别讨论即可~
- 时间复杂度:
代码
__EOF__

本文链接:https://www.cnblogs.com/zyyun/p/15355314.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!