Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健(37509)
- Result: AC Submission_id: 4267578
- Created at: Sat Apr 02 2022 11:50:25 GMT+0800 (China Standard Time)
- Problem: 5455 Time: 4 Memory: 1736
- */
- #include <stdio.h>
- int main(){
- char buffer[100] = { 0 };
- scanf("%s", buffer);
- int n = strlen(buffer), i;
- unsigned long long ans = 0, p = 0;
- for(i = n - 1; i >= 0; i--){
- ans |= ((unsigned long long)(buffer[i] - '0') << (unsigned long long )p);
- p++;
- }
- printf("%llu\n", ans);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment