文章
5
粉丝
367
获赞
1
访问
55.4k
#include<cstdio>
#include<string.h>
const int maxc=1000;
const int maxi=4000;
using namespace std;
int main()
{
char rc[maxc];
int r[maxc] = {0}, temp = 0, ans[maxi] = {0}, put[maxi] = { 0 };
while(scanf("%s", rc) != EOF)
{
int len = strlen(rc);
int sum = 0, end = 1;
for(int i = 0; i < len; i++){
r[i] = rc[i] - '0';
}
int i = 0, k = 0, p;
while(i < len)
{
ans[k++] = r[len-1] % 2;
temp = 0;
for(int j = i; j < len; j++)
{
p = r[j];
r[j] = (r[j] + temp) / 2;
if(p % 2 == 0) { temp = 0; }
else { temp = 10; }
if(r[i] == 0)
i++;
}
}
put[0] = 0;
for(int i = 0; i < k; i++)
{
for(int j = 0; j < end; j++){
if (j == 0){
put[j] = put[j] * 2 + ans[i];
}
else {
put[j] = put[j] * 2;
}
}
for(int j = 0; j < end; j++){
if(put[j] >= 10){
if (j == end - 1){
end++;
put[en...
登录后发布评论
暂无评论,来抢沙发