# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100360 | Ort | Lun (COCI19_lun) | C++11 | 3 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<cctype>
using namespace std;
string s;
vector<int> sv;
int n; bool t;
int main() {
cin.sync_with_stdio(0); cin.tie(0);
cin >> n;
cin >> s;
reverse(s.begin(),s.end());
for(int i=0;i<n;i++) {
if(isdigit(s[i])) {
if(i%2) {
int num = s[i]-'0';
num *= 2;
if(num>9) num = (num%10) + (num/10);
sv.push_back(num);
}
else sv.push_back(s[i]-'0');
}
else {sv.push_back(-1); if(i%2) t=1;}
}
long long sum = 0;
for(int i=0;i<n;i++) sum += (long long)(sv[i]!=-1?sv[i]:0);
if(!t) cout << (sum*9)%10;
else cout << (sum*9)/2 %10;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |