# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
570659 | AGE | Lun (COCI19_lun) | C++14 | 1 ms | 212 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<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long
using namespace std;
main()
{
int n;
cin>>n;
string s;
cin>>s;
reverse(s.begin(),s.end());
int index;
for(int i=0;i<s.size();i++)
if(s[i]=='x')
index=i;
if(index==0){
int sum=0;
for(int i=1;i<s.size();i++){
if(i%2!=0){
int x=s[i]-'0';
x*=2;
int y=0;
while(x){
y+=x%10;
x/=10;
}
sum+=y;
}
else
sum+=s[i]-'0';
}
sum*=9;
cout<<sum%10<<endl;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |