Submission #104090

#TimeUsernameProblemLanguageResultExecution timeMemory
104090wiritos1Lun (COCI19_lun)C++98
10 / 50
3 ms512 KiB
#include<bits/stdc++.h> using namespace std; int main() { int a; string b; cin>>a>>b; int tem; tem=b[a-1]-'0'; tem=10-tem; bool p2=false; int sum=0; for(int c=0;c<a;c++) { if(b[c]=='x') { if(a%2==0) { p2=false; } else { p2=true; } } else { if(a%2==0) { sum+=b[c]-'0'; } else { if(b[c]<'5') { sum+=b[c]-'0'; } else { sum+=((b[c]-'5')*2)+1; } } } } sum%=10; tem+=10; tem-=sum; tem%=10; //num a obtener if(tem%2==0) { tem/=2; } else { tem--; tem/=2; tem+=5; } cout<<tem; return 0; }

Compilation message (stderr)

lun.cpp: In function 'int main()':
lun.cpp:12:7: warning: variable 'p2' set but not used [-Wunused-but-set-variable]
  bool p2=false;
       ^~
#Verdict Execution timeMemoryGrader output
Fetching results...