#include <iostream>
using namespace std;
int main() {
int n, a, max = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a;
max += a;
}
cout << max;
return 0;
}
余数
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 2; i <= 9999; i++) {
if (i % n == 2) {
cout << i << endl;
}
}
return 0;
}
最大的数和它的位置
#include <iostream>
using namespace std;
int a[50010];
int main() {
int n, max = 0, maxi = 0;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++)
if (a[i] > max)
max = a[i], maxi = i;
cout << max << endl << maxi;
return 0;
}