5 solutions
-
0
#include <bits/stdc++.h> using namespace std;
int main() { int n,x=0; int a[105]; while (1) { cin>>n; if(n==0) break;
for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int v = n / 2 + 1; int x = 0; for (int j = 0; j <=n/2; j++) { x = x + (a[j] /2+ 1); } cout << x << endl;
} return 0; }
-
-1
#include <bits/stdc++.h> using namespace std;
int main() { int n; int x = 0; int a[105]; while (1) { cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); x=0; for (int j = 0; j <= n / 2; j++) { x = x + (a[j] / 2 + 1); } cout << x << endl; } return 0; }
-
-2
#include <bits/stdc++.h> using namespace std;
int main() { int n,x=0; int a[105]; while (1) { cin>>n; if(n==0) break;
for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int v = n / 2 + 1; int x = 0; for (int j = 0; j <=n/2; j++) { x = x + (a[j] /2+ 1); } cout << x << endl; } return 0;
}
-
-2
#include <bits/stdc++.h> using namespace std;
int main() { int n, x = 0;
while ( 1) { cin >> n; if (n == 0) break; int a[101]; for (int i = 0; i < n; i++) { cin >> a[i] ; } sort(a, a + n); int v = n / 2 + 1; for (int j = 0; j < v; j++) { x = x + a[j] / 2 + 1; } } cout << x << endl; return 0;
}
- 1
Information
- ID
- 361
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 7
- Tags
- # Submissions
- 131
- Accepted
- 27
- Uploaded By