mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
1b4d6396e4
2700-2799
38 lines
711 B
C++
38 lines
711 B
C++
#include<stdio.h>
|
|
#include<string.h>
|
|
int main()
|
|
{
|
|
char a[35];
|
|
int i,c,l;
|
|
while(gets(a)&&a[0]!='#')
|
|
{
|
|
c=0;
|
|
l=strlen(a);
|
|
for(i=0;i<=l-2;i++)
|
|
if(a[i]=='1')
|
|
c++;
|
|
if(a[l-1]=='e')
|
|
{
|
|
if(c%2!=0)
|
|
a[l-1]='1';
|
|
else
|
|
a[l-1]='0';
|
|
}
|
|
else
|
|
{
|
|
if(c%2!=0)
|
|
a[l-1]='0';
|
|
else
|
|
a[l-1]='1';
|
|
}
|
|
for(i=0;i<l;i++)
|
|
{
|
|
if(i==l-1)
|
|
printf("%c\n",a[i]);
|
|
else
|
|
printf("%c",a[i]);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|