Codeforces Round 867 (Div. 3) AK题解

news2024/11/17 0:04:14

目录

A. TubeTube Feed(签到)

题意:

思路:

代码:

B. Karina and Array(签到)

题意:

思路:

代码:

C. Bun Lover(结论)

题意:

思路:

代码:

D. Super-Permutation(思维)

题意:

思路:

代码:

E. Making Anti-Palindromes(思维)

题意:

思路:

代码:

F. Gardening Friends(图dfs)

题意:

思路:

代码:

G2. Magic Triples (Hard Version)(二分 / 枚举)

题意:

思路:

代码:


A. TubeTube Feed(签到)

Mushroom Filippov cooked himself a meal and while having his lunch, he decided to watch a video on TubeTube. He can not spend more than t seconds for lunch, so he asks you for help with the selection of video.

The TubeTube feed is a list of n videos, indexed from 1 to n. The i-th video lasts ai seconds and has an entertainment value bi. Initially, the feed is opened on the first video, and Mushroom can skip to the next video in 11 second (if the next video exists). Mushroom can skip videos any number of times (including zero).

Help Mushroom choose one video that he can open and watch in t seconds. If there are several of them, he wants to choose the most entertaining one. Print the index of any appropriate video, or −1 if there is no such.

Input

The first line of the input data contains a single integer q (1≤q≤1000) — the number of test cases in the test.

The description of the test cases follows.

The first line of a test case contains two integers n and t (1≤n≤50, 1≤t≤200) — the number of videos in the feed and seconds for lunch, respectively.

The second line of a test case contains n integers a1,a2,a3,…,an(1≤ai≤100) — durations of videos.

The third line of a test case contains n integers b1,b2,b3,…,bn(1≤bi≤100) — entertainment values of videos.

Output

Output q integers, each of which is the answer to the corresponding test case. As an answer, output the index of the most entertaining video that Mushroom will have time to watch. If there are several answers, you are allowed to output any of them. Output −1−1, if there is no video he can watch during his lunch break.

Example

input

5

5 9

1 5 7 6 6

3 4 7 1 9

4 4

4 3 3 2

1 2 3 4

5 7

5 5 5 5 5

2 1 3 9 7

4 33

54 71 69 96

42 24 99 1

2 179

55 66

77 88

output

3
2
3
-1
2

题意:

给定n个电视剧和时间T

每个电视剧需要ti秒看完,好看值ai,打开需要i-1秒,求T秒内能看到最好看的电视剧

思路:

枚举一遍

代码:

#include<bits/stdc++.h>
using namespace std;
int n,t;
void solve(){
    cin>>n>>t;
    vector<int>a(n+1),b(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int ans=-1;
    int pos=-1;
    for(int i=1;i<=n;i++){
        cin>>b[i];
        if(b[i]>ans){
            if(a[i]+i-1<=t){
                ans=b[i];
                pos=i;
            }
        }
    }
    cout<<pos<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T;
    cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

B. Karina and Array(签到)

Karina has an array of n integers a1,a2,a3,…,an. She loves multiplying numbers, so she decided that the beauty of a pair of numbers is their product. And the beauty of an array is the maximum beauty of a pair of adjacent elements in the array.

For example, for n=4, a=[3,5,7,4], the beauty of the array is max(3⋅5, 5⋅7, 7⋅4) = max(15, 35, 28) = 35.

Karina wants her array to be as beautiful as possible. In order to achieve her goal, she can remove some elements (possibly zero) from the array. After Karina removes all elements she wants to, the array must contain at least two elements.

Unfortunately, Karina doesn't have enough time to do all her tasks, so she asks you to calculate the maximum beauty of the array that she can get by removing any number of elements (possibly zero).

Input

The first line of the input contains an integer t (1≤t≤104) — the number of test cases.

The description of the test cases follows.

The first line of a test case contains an integer n (2≤n≤2⋅105) — the length of the array a.

The second line of a test case contains n integers a1,a2,a3,…,an (−109≤ai≤109) — the elements of the array a.

The sum of all values of n across all test cases does not exceed 2⋅1052⋅105.

Output

Output t integers, each of which is the answer to the corresponding test case — the maximum beauty of the array that Karina can get.

Example

input

7

4

5 0 2 1

3

-1 1 0

5

2 0 -1 -4 0

6

-8 4 3 7 1 -9

6

0 3 -2 5 -4 -4

2

1000000000 910000000

7

-1 -7 -2 -5 -4 -6 -3

output

10
0
4
72
16
910000000000000000
42

Note

In the first test case of the example, to get the maximum beauty, you need to remove the 22-nd element.

In the second and third test cases of the example, there is no need to remove any elements to achieve maximum beauty.

In the fourth test case of the example, you need to leave only the first and last elements.

题意:

给一个数组a,可以删去任意个元素,求相邻两个元素乘积的最大值

思路:

要么是两个最大数的积,要么是两个最小数的积

代码:

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin>>n;
    vector<ll>a(n);
    for(auto &i:a)cin>>i;
    sort(a.begin(),a.end());
    cout<<max(a[0]*a[1],a[n-1]*a[n-2])<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

C. Bun Lover(结论)

Tema loves cinnabon rolls — buns with cinnabon and chocolate in the shape of a "snail".

Cinnabon rolls come in different sizes and are square when viewed from above. The most delicious part of a roll is the chocolate, which is poured in a thin layer over the cinnabon roll in the form of a spiral and around the bun, as in the following picture:

For a cinnabon roll of size n, the length of the outer side of the square is n, and the length of the shortest vertical chocolate segment in the central part is one.

Formally, the bun consists of two dough spirals separated by chocolate. A cinnabon roll of size n+1 is obtained from a cinnabon roll of size n by wrapping each of the dough spirals around the cinnabon roll for another layer.

It is important that a cinnabon roll of size n is defined in a unique way.

Tema is interested in how much chocolate is in his cinnabon roll of size n. Since Tema has long stopped buying small cinnabon rolls, it is guaranteed that n≥4.

Answer this non-obvious question by calculating the total length of the chocolate layer.

Input

The first line of the input contains a single integer t (1≤t≤105) — the number of test cases.

The following t lines describe the test cases.

Each test case is described by a single integer n (4≤n≤109) — the size of the cinnabon roll.

Output

Output t integers. The i-th of them should be equal to the total length of the chocolate layer in the i-th test case.

Example

input

4

4

5

6

179179179

output

26
37
50
32105178545472401

题意:

给一个蛇形图,求所有边的长度和

思路:

找规律发现是(n+1)^2+1,

代码:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    ll n;
    cin>>n;
    n++;
    ll ans=n*n;
    cout<<ans+1<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    cin>>T;
    while(T--){
        solve();
    }

    return 0;
}

D. Super-Permutation(思维)

A permutation is a sequence n integers, where each integer from 1 to n appears exactly once. For example, [1], [3,5,2,1,4], [1,3,2] are permutations, while [2,3,2], [4,3,1], [0] are not.

Given a permutation a, we construct an array b, where bi=(a1+a2+ … +ai)modn.

A permutation of numbers [a1,a2,…,an]is called a super-permutation if [b1+1,b2+1,…,bn+1] is also a permutation of length n.

Grisha became interested whether a super-permutation of length n exists. Help him solve is non-trivial problem. Output any super-permutation of length n, if it exists. Otherwise, output −1−1.

Input

The first line contains a single integer t (1≤t≤104) — the number of test cases. The description of the test cases follows.

Each test case consists of a single line containing one integer n (1≤n≤2⋅105) — the length of the desired permutation.

The sum of n over all test cases does not exceed 2⋅1052⋅105.

Output

For each test case, output in a separate line:

  • n integers — a super-permutation of length n, if it exists.
  • −1, otherwise.

If there are several suitable permutations, output any of them.

Example

input

4

1

2

3

6

output

1
2 1
-1
6 5 2 3 4 1

题意:

若一个排列a,根据 bi=((a1+a2+ … +ai)mod n)+1 重构一个数组 b

找到一个排列a,使它的重构数组也是一个排列

思路:

手玩,发现奇数不可能构成这样的排列

偶数可以证明 n , 1 , n-2 , 3 , n-4 , 5 ...这样的排列的重组排列也是排列

代码:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin>>n;
    if(n==1){
        cout<<1<<endl;
        return;
    }
    if(n%2==1){
        cout<<-1<<endl;
        return;
    }
    for(int i=n;i>0;i-=2){
        cout<<i<<' '<<n+1-i<<' ';
    }
    cout<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    cin>>T;
    while(T--){
        solve();
    }

    return 0;
}

E. Making Anti-Palindromes(思维)

You are given a string s, consisting of lowercase English letters. In one operation, you are allowed to swap any two characters of the string s.

A string s of length n is called an anti-palindrome, if s[i]≠s[n−i+1] for every i (1≤i≤n. For example, the strings "codeforces", "string" are anti-palindromes, but the strings "abacaba", "abc", "test" are not.

Determine the minimum number of operations required to make the string s an anti-palindrome, or output −1, if this is not possible.

Input

The first line contains a single integer t (1≤t≤104) — the number of test cases. The description of the test cases follows.

Each test case consists of two lines. The first line contains a single integer n (1≤n≤2⋅105) — the length of the string s.

The second line contains the string s, consisting of n lowercase English letters.

The sum of n over all test cases does not exceed 2⋅105.

Output

For each test case, output a single integer — the minimum number of operations required to make the string s an anti-palindrome, or −1 if this is not possible.

Example

input

10

10

codeforces

3

abc

10

taarrrataa

10

dcbdbdcccc

4

wwww

12

cabbaccabaac

10

aadaaaaddc

14

aacdaaaacadcdc

6

abccba

12

dcbcaebacccd

output

0
-1
1
1
-1
3
-1
2
2
2

Note

In the first test case, the string "codeforces" is already an anti-palindrome, so the answer is 00.

In the second test case, it can be shown that the string "abc" cannot be transformed into an anti-palindrome by performing the allowed operations, so the answer is −1−1.

In the third test case, it is enough to swap the second and the fifth characters of the string "taarrrataa", and the new string "trararataa" will be an anti-palindrome, so the answer is 11.

题意:

给一次字符串,问几次操作后会变成反回文字符串

思路:

奇数长度字符串一定不是反回文

统计所有字母出现次数,若有大于n/2的,一定不可能反回文

统计反回文位置,一次交换操作可以消去两个位置(除了只剩一种字母的情况),若一次交换操作只能消去一个位置时,这种字符最多,必须全部消除,直接两种情况取最差即可

代码:

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
int cnt[26];
void solve(){
    int n;
    string s;
    cin>>n>>s;
    if(n%2==1){    //奇数长度不行
        cout<<-1<<endl;
        return;
    }
    s=' '+s;
    memset(cnt,0,sizeof(cnt));

    for(int i=1;i<=n;i++){
        cnt[s[i]-'a']++;
        if(cnt[s[i]-'a']>n/2){    //若某字符大于n/2
            cout<<-1<<endl;
            return;
        }
    }

    memset(cnt,0,sizeof(cnt));
    int tot=0;
    for(int i=1;i<=n/2;i++){
        if(s[i]==s[n+1-i]){
            cnt[s[i]-'a']++;    //字母次数
            tot++;    //统计次数
        }
    }

    sort(cnt,cnt+26);
    int ans=0;
    int tmp=0;
    cout<<max((tot+1)/2,*max_element(cnt,cnt+26))<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

F. Gardening Friends(图dfs)

Two friends, Alisa and Yuki, planted a tree with n vertices in their garden. A tree is an undirected graph without cycles, loops, or multiple edges. Each edge in this tree has a length of k. Initially, vertex 11 is the root of the tree.

Alisa and Yuki are growing the tree not just for fun, they want to sell it. The cost of the tree is defined as the maximum distance from the root to a vertex among all vertices of the tree. The distance between two vertices u and v is the sum of the lengths of the edges on the path from u to v.

The girls took a course in gardening, so they know how to modify the tree. Alisa and Yuki can spend c coins to shift the root of the tree to one of the neighbors of the current root. This operation can be performed any number of times (possibly zero). Note that the structure of the tree is left unchanged; the only change is which vertex is the root.

The friends want to sell the tree with the maximum profit. The profit is defined as the difference between the cost of the tree and the total cost of operations. The profit is cost of the tree minus the total cost of operations.

Help the girls and find the maximum profit they can get by applying operations to the tree any number of times (possibly zero).

Input

The first line of the input contains one integer t (1≤t≤104) — the number of test cases.

The description of the test cases follows.

The first line of each test case contains integers n, k, c (2≤n≤2⋅105; 1≤k,c≤109) — the number of vertices in the tree, the length of each edge, and the cost of the operation.

The next n−1 lines of the test case contain pairs of integers ui, vi (1≤ui,vi≤n) — the edges of the graph. These edges form a tree.

The sum of the values of n over all test cases does not exceed 2⋅1052⋅105.

Output

For each test case, output a single integer — the maximum profit that Yuki and Alisa can get.

Example

input

4

3 2 3

2 1

3 1

5 4 1

2 1

4 2

5 4

3 4

6 5 3

4 1

6 1

2 6

5 1

3 2

10 6 4

1 3

1 9

9 7

7 6

6 4

9 2

2 8

8 5

5 10

output

2
12
17
32

题意:

给一棵树,可以花费c元使 根往旁边移动一位,树的价值为 深度*k,输出 能赚的最多的钱

思路:

两遍dfs找出树上最长的链,不管根在何处,深度一定是到 链两端距离的最大值

dfs预处理出每个点到起始根的距离,然后枚举根的所有位置,更新答案即可

代码:

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;

ll n,k,c;
vector<int>edge[200005];
vector<int>dis,dis1,dis2,dis3;
void dfs(int x,int f){
    for(auto i:edge[x]){
        if(i==f)continue;
        dis[i]=dis[x]+1;
        dfs(i,x);
    }
}
void solve(){
    cin>>n>>k>>c;
    int pos;
    dis.resize(n+1,0);
    dis1.resize(n+1,0);
    dis2.resize(n+1,0);
    dis3.resize(n+1,0);
    
    for(int i=1;i<n;i++){
        int u,v;
        cin>>u>>v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    
    
    dis[1]=0;
    dfs(1,-1);
    for(int i=1;i<=n;i++){    //到初始根的距离
        dis1[i]=dis[i];
    }
    
    
    pos=max_element(dis1.begin()+1,dis1.end())-dis1.begin();
    dis[pos]=0;
    dfs(pos,-1);
    for(int i=1;i<=n;i++){    //到一端的距离
        dis2[i]=dis[i];
    }
    
    
    pos=max_element(dis2.begin()+1,dis2.end())-dis2.begin();
    dis[pos]=0;
    dfs(pos,-1);
    for(int i=1;i<=n;i++){    //到另一端的距离
        dis3[i]=dis[i];
    }
    
    
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,k*max(dis2[i],dis3[i])-c*dis1[i]);
    }
    cout<<ans<<endl;
    
    
    for(int i=1;i<=n;i++){
        edge[i].clear();
    }
    return;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

G2. Magic Triples (Hard Version)(二分 / 枚举)

This is the hard version of the problem. The only difference is that in this version, ai≤109.

For a given sequence of n integers a, a triple (i,j,k) is called magic if:

  • 1≤i,j,k≤n.
  • i, j, k are pairwise distinct.
  • there exists a positive integer b such that ai⋅b=aj and aj⋅b=ak.

Kolya received a sequence of integers a as a gift and now wants to count the number of magic triples for it. Help him with this task!

Note that there are no constraints on the order of integers i, j and k.

Input

The first line contains a single integer t (1≤t≤104) — the number of test cases. The description of the test cases follows.

The first line of the test case contains a single integer n (3≤n≤2⋅105) — the length of the sequence.

The second line of the test contains n integers a1,a2,a3,…,an (1≤ai≤109) — the elements of the sequence a.

The sum of n over all test cases does not exceed 2⋅105.

Output

For each test case, output a single integer — the number of magic triples for the sequence a.

Example

input

7

5

1 7 7 2 7

3

6 2 18

9

1 2 3 4 5 6 7 8 9

4

1000 993 986 179

7

1 10 100 1000 10000 100000 1000000

8

1 1 2 2 4 4 8 8

9

1 1 1 2 2 2 4 4 4

output

6
1
3
0
9
16
45

Note

In the first example, there are 6 magic triples for the sequence a — (2,3,5),(2,5,3), (3,2,5), (3,5,2), (5,2,3), (5,3,2).

In the second example, there is a single magic triple for the sequence a — (2,1,3).

题意:

给一个数组a,找出 i , j , k,是a[i],a[j],a[k]是等比数列,问有一个三元组

思路:

现将数组去重排序,然后枚举等比数列首项,再枚举公比,判断能否组成即可

如果某项个数 >=3 ,则三个自身可以组成等比数列

枚举公比时,二分查找第二项第三项,如果不符合则更新公比继续循环

代码:

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

void solve(){
    int n;
    cin>>n;
    map<ll,ll>m;
    for(int i=1;i<=n;i++){
        ll x;
        cin>>x;
        if(m.find(x)==m.end())m[x]=1;
        else m[x]++;
    }
    ll maxn=0;
    ll ans=0;
    for(auto it:m){
        maxn=max(maxn,it.first);
        if(it.second>=3)ans+=(it.second)*(it.second-1)*(it.second-2);
    }
    for(auto it:m){
        ll q=2;
        ll a=it.first;
        while(1){
            if(a*q*q>maxn)break;
            auto j=m.lower_bound(a*q);
            if((j->first)*q>maxn)break;
            if(j->first%a!=0){
                q=j->first/a+1;
                continue;
            }
            q=j->first/a;
            auto k=m.lower_bound(a*q*q);
            if(k->first!=a*q*q){
                q++;
                continue;
            }
            q++;
            ans+=k->second*it.second*j->second;
        }
    }
    cout<<ans<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    cin>>T;
    while(T--){
        solve();
    }
    return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/493253.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

C++类和对象(5)

类和对象 1.流插入和流提取的运算符重载2.const成员3.取地址及const取地址操作符重载 1.流插入和流提取的运算符重载 通过函数重载&#xff0c;可以对流插入运算符和流提取运算符进行运算符重载。<<流插入在ostream中&#xff0c;>>流提取在istream中。 ① 流提取…

SpringCloud全面学习笔记之初窥门径篇

目录 前言Docker初见小鲸鱼Docker架构Docker的安装Docker基操Dockerfile自定义镜像Docker-ComposeDocker镜像仓库 异步通信初识MQ同步通讯异步通讯MQ常见框架 RabbitMQ快速入门RabbitMQ概述和安装常见消息模型快速入门 SpringAMQPBasic Queue 简单队列模型Work Queue 工作队列模…

ChatGPT - 高效编写Prompt

文章目录 概念prompt基本结构如何编写prompt指导组合使用将指令提示、角色提示和种子词提示技术结合使用&#xff1a;将标准提示、角色提示和种子词提示技术结合使用的示例&#xff1a; 资料 概念 prompt 是给预训练语言模型 的一个线索/提示&#xff0c;更好的理解 人类的问题…

深入剖析PyTorch和TensorFlow:理解二者的区别与联系

❤️觉得内容不错的话&#xff0c;欢迎点赞收藏加关注&#x1f60a;&#x1f60a;&#x1f60a;&#xff0c;后续会继续输入更多优质内容❤️ &#x1f449;有问题欢迎大家加关注私戳或者评论&#xff08;包括但不限于NLP算法相关&#xff0c;linux学习相关&#xff0c;读研读博…

java基础入门-02-【面向对象】

Java基础入门-02-【面向对象】 8、面向对象8.1. 类和对象8.1.1 类和对象的理解8.1.2 类的定义8.1.3 对象的使用8.1.4 学生对象-练习 8.2. 对象内存图8.2.1 单个对象内存图8.2.2 多个对象内存图 8.3. 成员变量和局部变量8.3.1 成员变量和局部变量的区别 8.4. 封装8.4.1 封装思想…

JavaSE基础(四)—— 数组、内存分配

目录 一、数组的定义 1. 静态初始化数组 1.1 数组的访问 1.2 数组的几个注意事项 2. 动态初始化数组 2.1 动态初始化数组的元素默认值 3. 两种初始化的的使用场景总结、注意事项说明 二、数组的遍历 三、数组的案例 1. 数组元素求和 2. 数组求最值 3. 数组…

系统辨识——最小二乘法

基本原理 数学推导 最小二乘法是通过输入数据与输出数据来拟合已知结构的函数关系&#xff0c;也就是说已知二者的函数关系&#xff0c;通过最小二乘法估计函数的相关参数。假设 x , y x,y x,y存在以下函数关系&#xff1a; 但是在实际中&#xff0c;测量数据时存在测量误差或…

JavaScript call,callee,caller,apply,bind之间的区别

&#xff08;现实是此岸&#xff0c;梦想是彼岸&#xff0c;中间隔着湍急的河流&#xff0c;行动则是架在河上的桥梁。——克雷洛夫&#xff09; call call() 方法使用一个指定的 this 值和单独给出的一个或多个参数来调用一个函数。 MDN链接 call方法可以将一个对象属性作为…

ChatGPT AI使用成本

LLM “经济学”&#xff1a;ChatGPT 与开源模型&#xff0c;二者之间有哪些优劣权衡&#xff1f;谁的部署成本更低&#xff1f; 太长不看版&#xff1a;对于日均请求在 1000 次左右的低频使用场景&#xff0c;ChatGPT 的实现成本低于部署在 AWS 上的开源大模型。但面对每天数以…

Qt 从入门到入土

本文目录 1. Qt 概述1.1 什么是 Qt1.2 Qt 的发展史1.3 支持的平台1.4 Qt 的版本1.5 Qt 的优点1.6 成功案例 2. 创建 Qt 项目2.1 使用向导创建2.2 手动创建2.3 .pro文件2.4 一个最简单的 Qt 应用程序2.5 Qt 命名规范和常用快捷键 3. 第一个 Qt 小程序3.1 按钮的创建3.2 对象模型…

基于springboot的学生成绩管理系统

摘 要 随着信息技术和网络技术的飞速发展&#xff0c;人类已进入全新信息化时代&#xff0c;传统管理技术已无法高效&#xff0c;便捷地管理信息。为了迎合时代需求&#xff0c;优化管理效率&#xff0c;各种各样的管理系统应运而生&#xff0c;各行各业相继进入信息管理时代&…

LeetCode第2题——两数相加(Java)

题目描述&#xff1a; ​ 给你两个 非空 的链表&#xff0c;表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的&#xff0c;并且每个节点只能存储 一位 数字。 ​ 请你将两个数相加&#xff0c;并以相同形式返回一个表示和的链表。 ​ 你可以假设除了数字 0 之外…

考研数据结构--数组与广义表

数组与广义表 文章目录 数组与广义表数组数组的基本概念性质数组的存储结构一维数组的存储结构二维数组的存储结构 特殊矩阵的压缩存储对称矩阵上三角矩阵下三角矩阵对角矩阵 稀疏矩阵定义稀疏矩阵的三元组表示稀疏矩阵的存储结构及其基本运算算法定义存入三元组三元组元素赋值…

ChatGPT in Drug Discovery

ChatGPT是OpenAI开发的一种语言模型。这是一个在大型人类语言数据集上训练的机器学习模型&#xff0c;能够生成类似人类语言文本。它可以用于各种自然语言处理任务&#xff0c;如语言翻译、文本摘要和问题回答。在目前的工作中&#xff0c;我们讨论了ChatGPT在药物发现中的应用…

矩阵乘法之叉乘和点乘

矩阵的乘法包含两种&#xff1a;点乘和叉乘。 矩阵点乘的含义是对应元素相乘&#xff0c;例如矩阵&#xff0c;同样存在矩阵, 那么. 矩阵叉乘含义与我们平时理解矩阵相乘一致&#xff0c;即一个矩阵A&#xff0c;若要与另外一个矩阵相乘&#xff0c;另另外一个矩阵的行数必须…

【iOS】NSOperation,NSOperationQueue

文章目录 前言概念使用NSOperation&#xff0c;NSoperationQueue的好处操作和操作队列操作&#xff08;Operation&#xff09;操作队列&#xff08;Operation Queues&#xff09; NSOperation&#xff0c;NSOperationQueue常用属性和方法归纳NSOperation常用属性和方法NSOperat…

阶乘求和,求 1 + 2 + 3 + ... + 202320232023 ,阶乘总和的末尾九位数字

求 1! 2! 3! … 202320232023! &#xff0c;总和的末尾九位数字。 【学习的细节是欢悦的历程】 Python 官网&#xff1a;https://www.python.org/ Free&#xff1a;大咖免费“圣经”教程《 python 完全自学教程》&#xff0c;不仅仅是基础那么简单…… 地址&#xff1a;ht…

learn_C_deep_8 (循环语法的理解、void的用法以及理解)

目录 循环语法的理解 break关键字 continue关键字 continue跳转的位置 goto关键字 void的用法以及理解 void是否可以定义变量 为何 void 不能定义变量 void的应用场景 void 指针 循环语法的理解 for循环是一种常用的循环结构&#xff0c;它适合于在已知循环次数的情况…

ChatGPT prompt engineering (中文版)笔记 |吴恩达ChatGPT 提示工程

目录 一、资料二、 指南环境配置两个基本原则&#xff08;最重要!!!!&#xff09;原则一&#xff1a;编写清晰、具体的指令**策略一&#xff1a;使用分隔符清晰地表示输入的不同部分**&#xff0c;**分隔符可以是&#xff1a;&#xff0c;""&#xff0c;<>&…

浅谈几个通信概念-如何理解卷积,负频率,傅里叶变换,奈奎斯特采样定理?

1.如何理解卷积&#xff1f; t时刻的输出信号是t时刻之前的无数小的脉冲序列冲击引起的。 2. 如何理解欧拉公式&#xff0c;复指数信号呢&#xff1f; 可以看成一个点在复平面上以角速度w进行逆时针的旋转。 傅里叶分析&#xff1a; 整体到部分&#xff0c;把一个信号分解成无…