adauga ce o fi asta in plm l-am facut aseara dar am uitat sa dau commit lol
This commit is contained in:
parent
cf40dce705
commit
f5e92827e7
1 changed files with 27 additions and 0 deletions
27
3033/solutie.cpp
Normal file
27
3033/solutie.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n, a=0, cp = 0, s = 0, b=0;
|
||||
cin >> n;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> b;
|
||||
cp = b;
|
||||
a = 0;
|
||||
while (cp != 0) {
|
||||
a++;
|
||||
cp = cp / 10;
|
||||
}
|
||||
cp = b;
|
||||
if (a % 2 == 1) {
|
||||
for (int j = 0; j < (a-1)/2; j++) {
|
||||
cp = cp / 10;
|
||||
}
|
||||
s = s + (cp%10);
|
||||
}
|
||||
}
|
||||
cout << s;
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue