题解 | #压缩二维码#
压缩二维码
https://www.nowcoder.com/practice/1150d36c2cd64df9bf373988486c6723
#include <iostream>
using namespace std;
int main() {
int n;
string res;
cin >> n;
char temp;
while(cin >> temp){
if(temp == '.')res += '0';
else if(temp == '#') res += '1';
}
for(int i = 0; i < res.size(); i += 4){
cout << 8 * (res[i] - '0') + 4 * (res[i+1] - '0') + 2 * (res[i+2] - '0') + (res[i+3] - '0') << ' ';
}
}
依照题意模拟即可, 个人认为不需要按照n来进行读入(所以把它搁在一边就好)
#牛客创作赏金赛#言の随记题解 文章被收录于专栏
喵喵喵喵喵
查看14道真题和解析