[root@localhost ~] Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE demo latest 1e5f6711d527 3 days ago 178MB [root@localhost ~]# docker tag demo:latest ***/demo:v1 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE demo latest 1e5f6711d527 3 days ago 178MB ***/demo v1 1e5f6711d527 3 days ago 178MB [root@localhost ~]#
Push
1 2 3 4 5 6 7 8
[root@localhost ~]# docker push ***/demo:v1 The push refers to repository [docker.io/***/demo:v1] 833a0t6a6ff9: Pushed 10bfe4y2500e: Pushed d43sfdd7d594: Mounted from library/nginx c2adabsadfed: Mounted from library/nginx v1: digest: sha256:67dcdae5578c0374019bdc899731543cfd7c48fe5780e84233a258f2bf7d2ceda size: 1155 [root@localhost ~]#
Pull
1 2 3 4 5
[root@localhost ~]# docker pull ***/demo:v1 v1: Pulling from ***/demo:v1 Digest: sha256:67dcdae5578c0374019bdc899731543cfd7c48fe5780e84233a258f2bf7d2ceda Status: Downloaded newer image for ***/demo:v1 docker.io/llxxyy/nginx-io:v1
voidquick_sort(int q[],int l,int r) { if(l>=r) return; int i = l-1; int j = r+1; int x = q[(l+r)/2]; while(i<j){ do i++; while(q[i]<x); do j--; while(q[j]>x); if(i<j) swap(q[i],q[j]); } quick_sort(q,l,j); quick_sort(q,j+1,r); }
vector<int> div(vector<int> &A, int b ,int &r){ vector<int> C;// 商 r = 0;// 余数 // 从最高位开始算--不同于其他几种计算 for(int i = A.size() - 1;i >= 0 ; i--){ r = r * 10 + A[i]; C.push_back(r / b); r %= b; } reverse(C.begin() ,C.end()); while(C.size()>1 && C.back()==0) C.pop_back(); // 去除前导0 return C; }
intmain() { string a; int b; vector<int> A; cin>>a>>b; for(int i = a.size()-1;i>=0;i--){ A.push_back(a[i]-'0'); } int r; auto C = div(A,b,r); for(int i = C.size()-1;i>=0;i--){ printf("%d",C[i]); } cout<<endl; cout<<r<<endl; }
// 二分求出x对应的离散化的值 intfind(int x)// 找到第一个大于等于x的位置 { int l = 0, r = alls.size() - 1; while (l < r) { int mid = l + r >> 1; if (alls[mid] >= x) r = mid; else l = mid + 1; } return r + 1; // 映射到1, 2, ...n }
802.区间和 难☹️
假定有一个无限长的数轴,数轴上每个坐标上的数都是 0 现在,我们首先进行 n 次操作,每次操作将某一位置 x 上的数加 c 接下来,进行 m 次询问,每个询问包含两个整数 l 和 r,你需要求出在区间 [l,r] 之间的所有数的和
输入格式
第一行包含两个整数 n 和 m 接下来 n 行,每行包含两个整数 x 和 再接下来 m 行,每行包含两个整数 l 和 r
int st = -2e9, ed = -2e9; for (auto seg : segs) if (ed < seg.first) { if (st != -2e9) res.push_back({st, ed}); st = seg.first, ed = seg.second; } else ed = max(ed, seg.second);
if (st != -2e9) res.push_back({st, ed});
segs = res; }
803. 区间合并
给定 n 个区间 [li,ri],要求合并所有有交集的区间。 注意如果在端点处相交,也算有交集。 输出合并完成后的区间个数。
// returns the view matrix calculated using Euler Angles and the LookAt Matrix glm::mat4 GetViewMatrix() { return glm::lookAt(Position, Position + Front, Up); } };
ProcessKeyboard处理从任何类似键盘的输入系统接收的输入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
voidProcessKeyboard(Camera_Movement direction, float deltaTime) { float velocity = MovementSpeed * deltaTime; if (direction == FORWARD) Position += Front * velocity; if (direction == BACKWARD) Position -= Front * velocity; if (direction == LEFT) Position -= Right * velocity; if (direction == RIGHT) Position += Right * velocity; if (direction == DOWN) Position -= Up * velocity; if (direction == UP) Position += Up * velocity; }
// make sure that when pitch is out of bounds, screen doesn't get flipped if (constrainPitch) { if (Pitch > 89.0f) Pitch = 89.0f; if (Pitch < -89.0f) Pitch = -89.0f; }
// update Front, Right and Up Vectors using the updated Euler angles updateCameraVectors(); }
voidupdateCameraVectors() { // calculate the new Front vector glm::vec3 front; front.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch)); front.y = sin(glm::radians(Pitch)); front.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch)); Front = glm::normalize(front); // also re-calculate the Right and Up vector Right = glm::normalize(glm::cross(Front, WorldUp)); Up = glm::normalize(glm::cross(Right, Front)); }
// tell GLFW to capture our mouse glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
// glad: load all OpenGL function pointers // --------------------------------------- if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << "Failed to initialize GLAD" << std::endl; return-1; } // configure global opengl state // ----------------------------- glEnable(GL_DEPTH_TEST);
structVertex { // position glm::vec3 Position; // normal 法线 glm::vec3 Normal; // texCoords glm::vec2 TexCoords; // tangent 切线 glm::vec3 Tangent; // bitangent 双切线 glm::vec3 Bitangent; //bone indexes which will influence this vertex int m_BoneIDs[MAX_BONE_INFLUENCE]; //weights from each bone float m_Weights[MAX_BONE_INFLUENCE]; };
// returns the view matrix calculated using Euler Angles and the LookAt Matrix glm::mat4 GetViewMatrix() { return glm::lookAt(Position, Position + Front, Up); } };
ProcessKeyboard处理从任何类似键盘的输入系统接收的输入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
voidProcessKeyboard(Camera_Movement direction, float deltaTime) { float velocity = MovementSpeed * deltaTime; if (direction == FORWARD) Position += Front * velocity; if (direction == BACKWARD) Position -= Front * velocity; if (direction == LEFT) Position -= Right * velocity; if (direction == RIGHT) Position += Right * velocity; if (direction == DOWN) Position -= Up * velocity; if (direction == UP) Position += Up * velocity; }
// make sure that when pitch is out of bounds, screen doesn't get flipped if (constrainPitch) { if (Pitch > 89.0f) Pitch = 89.0f; if (Pitch < -89.0f) Pitch = -89.0f; }
// update Front, Right and Up Vectors using the updated Euler angles updateCameraVectors(); }
voidupdateCameraVectors() { // calculate the new Front vector glm::vec3 front; front.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch)); front.y = sin(glm::radians(Pitch)); front.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch)); Front = glm::normalize(front); // also re-calculate the Right and Up vector Right = glm::normalize(glm::cross(Front, WorldUp)); Up = glm::normalize(glm::cross(Right, Front)); }
// render the loaded model glm::mat4 model = glm::mat4(1.0f); model = glm::translate(model, glm::vec3(0.0f, 0.0f, 0.0f)); // translate it down so it's at the center of the scene model = glm::scale(model, glm::vec3(1.0f, 1.0f, 1.0f)); // it's a bit too big for our scene, so scale it down ourShader.setMat4("model", model); ourModel.Draw(ourShader); // ourModel2.Draw(ourShader); // ourModel3.Draw(ourShader);
//-- lightCubeShader.use(); lightCubeShader.setMat4("projection", projection); lightCubeShader.setMat4("view", view); model = glm::mat4(1.0f); model = glm::translate(model, lightPos); model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube lightCubeShader.setMat4("model", model); //--
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.) // ------------------------------------------------------------------------------- glfwSwapBuffers(window); glfwPollEvents(); }