Submission #104090

# Submission time Handle Problem Language Result Execution time Memory
104090 2019-04-04T02:09:25 Z wiritos1 Lun (COCI19_lun) C++
10 / 50
3 ms 512 KB
#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

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 time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Incorrect 3 ms 512 KB Output isn't correct
5 Incorrect 3 ms 256 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 3 ms 256 KB Output isn't correct
8 Correct 2 ms 384 KB Output is correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Incorrect 3 ms 384 KB Output isn't correct