Base2

发布时间:2023-06-19 09:28:55 来源: 哔哩哔哩

Problem Statement

You are given a sequence 


(相关资料图)

A=(A 0 ,A 1 ,…,A 63 ) of length 64 consisting of 0 and 1.Find A 0 2 0 +A 1 2 1 +⋯+A 63 2 63

Constraints

A i  is 0 or 1.

Input

The input is given from Standard Input in the following format:

A 0A 1… A 63 

Output

Print the answer as an integer.

Sample Input 1 

1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Sample Output 1 

13

A 0 2 0 +A 1 2 1 +⋯+A 63 2 63 =2 0 +2 2 +2 3 =13.

Sample Input 2 

1 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0

Sample Output 2 

766067858140017173

用int或者long或者double都会存在溢出的情况,所以用java的bigInteger处理,当然也可以位运算,只是我不会了。。。

标签:

Copyright   2015-2022 华南创新网版权所有  备案号:粤ICP备18025786号-52   联系邮箱: 954 29 18 82 @qq.com