#include <iostream>using namespace std;
inline int read() {
int k = 0, f = 1;char c = getchar();
while (c < '0' || c > '9') {
if (c == '-')f = -1;
c = getchar();
}
while (c >= '0' && c <= '9')k = (k << 3) + (k << 1) + (c ^ 48), c = getchar();
return k * f;}
int main() {
int n, m;
n = read();
return 0;}
C++
#include <iostream>using namespace std;
int read() {
int k = 0, f = 1;char c = getchar_unlocked();
while (c < '0' || c > '9') {if (c == '-')f = -1;c = getchar_unlocked();}
while (c >= '0' && c <= '9')k = (k << 3) + (k << 1) + (c ^ 48), c = getchar_unlocked();
return k * f;}
int main() {
int n, m,ans=0;
n = read();
for (int i=0;i<n;i++){
m=read(),ans+=m;
}
printf("%d",ans);
return 0;
}
C++
void print(int x) {
if (x < 0)
putchar_unlocked('-'), x = -x;
if (x < 10)
putchar_unlocked(x + '0');
elseprint(x / 10), putchar_unlocked(x % 10 + '0');
}
C++
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + (ch - '0');
ch = getchar();
}
return x * f;
}
inline void print(int x) {
if (x < 0) {
putchar('-');
x = -x;
}
char buf[12];
int len = 0;
if (x == 0) {
buf[len++] = '0';
} else {
while (x > 0) {
buf[len++] = x % 10 + '0';
x /= 10;
}
}
for (int i = len - 1; i >= 0; i--) {
putchar(buf[i]);
}
}
C++
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock
inline string read_str() {
string s;
char c = getchar_unlocked();
while (c == ' ' || c == '\n' || c == '\r')
c = getchar_unlocked();
while (c != ' ' && c != '\n' && c != '\r' && c != EOF) {
s += c;
c = getchar_unlocked();
}
return s;
}
int read() {
int k = 0, f = 1;
char c = getchar_unlocked();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar_unlocked();
}
while (c >= '0' && c <= '9')
k = (k << 3) + (k << 1) + (c ^ 48), c = getchar_unlocked();
return k * f;
}
inline void print(int x) {
if (x < 0)
putchar_unlocked('-'), x = -x;
if (x < 10)
putchar_unlocked(x + '0');
elseprint(x / 10), putchar_unlocked(x % 10 + '0');
}
C++
#include <iostream>#include <string>using namespace std;
// 快速读取字符(Windows环境)#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock
// 快速读取整数inline int read_int() {
int x = 0, f = 1;
char c = getchar_unlocked();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar_unlocked();
}
while (c >= '0' && c <= '9') {
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar_unlocked();
}
return x * f;
}
// 快速读取字符串(读取到空格/换行停止)inline string read_str() {
string s;
char c = getchar_unlocked();
// 跳过前导空白字符while (c == ' ' || c == '\n' || c == '\r') c = getchar_unlocked();
// 读取字符串直到空白字符while (c != ' ' && c != '\n' && c != '\r' && c != EOF) {
s += c;
c = getchar_unlocked();
}
return s;
}
// 快速读取整行(包括空格)inline string read_line() {
string s;
char c = getchar_unlocked();
while (c != '\n' && c != '\r' && c != EOF) {
s += c;
c = getchar_unlocked();
}
return s;
}
// 快速输出整数inline void write_int(int x) {
if (x < 0) {
putchar_unlocked('-');
x = -x;
}
if (x > 9) write_int(x / 10);
putchar_unlocked(x % 10 + '0');
}
// 快速输出字符串inline void write_str(const string& s) {
for (char c : s) {
putchar_unlocked(c);
}
}
// 快速输出C风格字符串inline void write_str(const char* s) {
while (*s) {
putchar_unlocked(*s);
s++;
}
}
// 快速输出整数并换行inline void writeln_int(int x) {
write_int(x);
putchar_unlocked('\n');
}
// 快速输出字符串并换行inline void writeln_str(const string& s) {
write_str(s);
putchar_unlocked('\n');
}
// 快速输出C风格字符串并换行inline void writeln_str(const char* s) {
write_str(s);
putchar_unlocked('\n');
}
筛
C++
const int N = 1e8 + 5;
vector<int> pri;
bool prime[N];
void pre(int n) {
for (int i = 2; i <= n; ++i) {
if (!prime[i]) {
pri.push_back(i);
}
for (int pri_j : pri) {
if (i * pri_j > n)
break;
prime[i * pri_j] = 1;
}
}
}
C++
#include <iostream>#include <vector>using namespace std;
const int N = 1e8 + 5;
vector<int> pri;
int vis[N];
int n, q;
inline int read() {
int k = 0, f = 1;
char c = getchar_unlocked();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = getchar_unlocked();
}
while (c >= '0' && c <= '9')
k = (k << 3) + (k << 1) + (c ^ 48), c = getchar_unlocked();
return k * f;
}
inline void print(int x) {
if (x < 0)
putchar_unlocked('-'), x = -x;
if (x < 10)
putchar_unlocked(x + '0');
elseprint(x * 0x1999999A >> 32), putchar_unlocked(x % 10 + '0');
}
signed main() {
n = read();
for (int i = 2; i <= n; i++) {
if (vis[i] == 0)
vis[i] = i, pri.push_back(i);
for (int j : pri) {
if (i * j > n || j > vis[i])
break;
vis[i * j] = j;
}
}
q = read();
while (q--) {
n = read();
print(pri[n - 1]), putchar_unlocked('\n');
}
return 0;
}