#include<iostream>usingnamespace std;intmain(){int var =20;// 实际变量的声明int*ip;// 指针变量的声明ip =&var;// 在指针变量中存储 var 的地址cout <<"Value of var variable: ";cout << var << endl;// 输出在指针变量中存储的地址cout <<"Address stored in ip variable: ";cout << ip << endl;// 访问指针中地址的值cout <<"Value of *ip variable: ";cout <<*ip << endl;return0;}
#include<iostream>usingnamespace std;constint MAX =3;intmain(){int var[MAX]={10,100,200};int*ptr;// 指针中的数组地址ptr = var;for(int i =0; i < MAX; i++){cout <<"Address of var["<< i <<"] = ";cout << ptr << endl;cout <<"Value of var["<< i <<"] = ";cout <<*ptr << endl;// 移动到下一个位置ptr++;}return0;}
4.2 指针的递减
实例:下面的程序递减变量指针,以便顺序访问数组中的每一个元素。
#include<iostream>usingnamespace std;constint MAX =3;intmain(){int var[MAX]={10,100,200};int*ptr;// 指针中最后一个元素的地址ptr =&var[MAX-1];for(int i = MAX; i >0; i--){cout <<"Address of var["<< i <<"] = ";cout << ptr << endl;cout <<"Value of var["<< i <<"] = ";cout <<*ptr << endl;// 移动到下一个位置ptr--;}return0;}
https://vjudge.net/contest/587311#problem/H
先转化一波条件: p i ≥ 1 X p_i\ge \frac 1 X pi≥X1 p i ≤ 1 1 − Y p_i\le \frac 1 {1-Y} pi≤1−Y1
所以我们按 p p p 排序, s u m x sum_x sumx 必然是后缀, s u m y sum_y …
论文标题:PaLM-E: An Embodied Multimodal Language Model 论文作者:Danny Driess, Fei Xia, Mehdi S. M. Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, Wenlong Huang, Yevgen C…