95pts了,意识到不能边输出边判error,于是先判error。但是95
```
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
int lll=1;
char a[100005];
while(cin>>a[lll])
{
if(a[lll]!='0'&&a[lll]!='1')
{cout<<"Error";return 0;}
lll++;
}
lll--;
if(lll%8!=0) {cout<<"Error";return 0;}
int hhs=lll/8;
int bj=0,pre=0;
for(int i=1;i<=hhs;i++)
{
int top=8*(i-1)+1;
if(a[top]=='1'&&a[top+1]=='0'&&a[top+2]=='1')
{
int q=(a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1;
if(q>25)
{
cout<<"Error";
return 0;
}
}
else if(!(a[top]=='1'&&a[top+1]=='1'&&a[top+2]=='1')&&!(a[top='0']))
{
cout<<"Error";
return 0;
}
}
for(int i=1;i<=hhs;i++)
{
int top=8*(i-1)+1;
if(a[top]=='1'&&a[top+1]=='1'&&a[top+2]=='1')
{
cout<<' ';
continue;
}
else if(a[top]=='1'&&a[top+1]=='0'&&a[top+2]=='1')
{
cout<<(char)((a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1+'A');
continue;
}
else if(a[top]=='0')
{
if(bj==1){
cout<<pre+((a[top+1]-'0')*64+(a[top+2]-'0')*32+(a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1)/2;
pre=0;
bj=0;
continue;
}
if(bj==0)
{
pre=((a[top+1]-'0')*64+(a[top+2]-'0')*32+(a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1)/2;
bj=1;
continue;
}
}
}
return 0;
}
```
by p_Hydroxy @ 2023-09-09 11:10:53
@[p_Hydroxy](/user/551788) 三、若【第一个字符】为0 0 0,则该单元表示一个数,待定与下一个单元所表示的数做加法。
by __pig__ @ 2023-09-09 13:56:37
@[p_Hydroxy](/user/551788) hack:
```
0000000000000000
```
by __pig__ @ 2023-09-09 13:57:40
1. “待定与下一个单元所表示的数做加法”,所以对于一个数需要下一个也是数才加,否则```Error```。
2. 如果最后一个单元是数,而且是第一个数,就没有数与它加,所以是```Error```。
/kk
by lovely_fcukh @ 2023-09-09 14:00:34
@[p_Hydroxy](/user/551788) ok了。。。
```cpp
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
int lll=1;
char a[100005];
while(cin>>a[lll]) {
if(a[lll]!='0'&&a[lll]!='1') {
cout<<"Error";
return 0;
}
lll++;
}
lll--;
if(lll%8!=0) {
cout<<"Error";
return 0;
}
int hhs=lll/8;
int bj=0,pre=0,flag=0;
for(int i=1; i<=hhs; i++) {
int top=8*(i-1)+1;
if(a[top]=='1'&&a[top+1]=='0'&&a[top+2]=='1') {
int q=(a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1;
if(q>25) {
cout<<"Error";
return 0;
}
} else if(!(a[top]=='1'&&a[top+1]=='1'&&a[top+2]=='1')&&!(a[top]=='0')) {
cout<<"Error";
return 0;
}
if(a[top]=='0')flag^=1;
if(a[top]=='0'&&flag){
top=8*i+1;
if(a[top]!='0'){
cout<<"Error";
return 0;
}
}
}
for(int i=1; i<=hhs; i++) {
int top=8*(i-1)+1;
if(a[top]=='1'&&a[top+1]=='1'&&a[top+2]=='1') {
cout<<' ';
continue;
} else if(a[top]=='1'&&a[top+1]=='0'&&a[top+2]=='1') {
cout<<(char)((a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1+'A');
continue;
} else if(a[top]=='0') {
if(bj==1) {
cout<<pre+((a[top+1]-'0')*64+(a[top+2]-'0')*32+(a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1)/2;
pre=0;
bj=0;
continue;
}
if(bj==0) {
pre=((a[top+1]-'0')*64+(a[top+2]-'0')*32+(a[top+3]-'0')*16+(a[top+4]-'0')*8+(a[top+5]-'0')*4+(a[top+6]-'0')*2+(a[top+7]-'0')*1)/2;
bj=1;
continue;
}
}
}
return 0;
}
```
by lovely_fcukh @ 2023-09-09 14:33:05
@[oier01](/user/721959) @[lovely_fcukh](/user/335786)
谢谢你们
by p_Hydroxy @ 2023-09-09 15:44:20