#include <iostream>
class MyLinkedList{
public:
struct LinkedNode{
int val;
LinkedNode* next;
LinkedNode(int x):val(x),next(NULL){};
};
MyLinkedList(){
dummyHead=new LinkedNode(0);
length=0;
}
~MyLinkedList(){
while (dummyHead){
LinkedNode* tmp=dummyHead;
dummyHead=dummyHead->next;
delete tmp;
}
}
void AddTail(int value){
LinkedNode* newnode=new LinkedNode(value);
LinkedNode* cur=dummyHead;
while (cur->next!=NULL){
cur=cur->next;
}
cur->next=newnode;
length++;
}
bool Is_Legal(int index){
if (index<2||index>length){
return false;
}
else return true;
}
void DeleteAtIndex(int index){
LinkedNode* cur=dummyHead;
index-=2;
while (index--){
cur=cur->next;
}
LinkedNode* tmp=cur->next;
cur->next=cur->next->next;
delete tmp;
tmp=NULL;
length--;
}
void PrintLinkedList(){
LinkedNode* cur=dummyHead;
while (cur->next!=NULL){
std::cout<<cur->next->val<<" ";
cur=cur->next;
}
}
private:
LinkedNode* dummyHead;
int length;
};
int main() {
MyLinkedList list;
int n,a;
std::cin>>n;
while (n--){
std::cin>>a;
list.AddTail(a);
}
int i;
std::cin>>i;
if (list.Is_Legal(i)){
list.DeleteAtIndex(i);
list.PrintLinkedList();
}
else std::cout<<"error!";
return 0;
}
【STL】
#include<iostream>
#include<vector>
#include<algorithm>
int main() {
int n;
std::cin >> n;
std::vector<int> vec(n);
for (int i = 0; i < n; i++) std::cin >> vec[i];
int i;
std::cin >> i;
if (i >= 2 && i <= n) {
vec.erase(vec.begin() + i - 2);
for (int a : vec) {
std::cout << a << " ";
}
}
else std::cout << "error!";
return 0;
}
先估算这个数小于3的50次方 cnt0
for i in range(50):for j in range(50):for k in range(50):a3**ib5**jc7**kif a*b*c<59084709587505:cnt1
print(cnt-1)#当ijk都为0时,a*b*c1不是幸运数字所以要减去
目录
前言
web ui
ValueError: When localhost is not accessible 前言
使用 text-generation-webui 生成大模型界面,这个是专门用于文本对话生成的 web ui 界面
GitHub - oobabooga/text-generation-webui: A Gradio web UI for Large Language Models. Suppo…
文章目录 1. 【Meta AI】Emerging Properties in Self-Supervised Vision Transformers2. 【Meta AI】DINOv2: Learning Robust Visual Features without Supervision3. 【NeurIPS 2023】Diffusion Hyperfeatures: Searching Through Time and Space for Semantic Corresponden…