Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健
- Result: AC Submission_id: 4144645
- Created at: Thu Mar 10 2022 08:39:45 GMT+0800 (China Standard Time)
- Problem_id: 5407 Time: 21 Memory: 1704
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- #include <ctype.h>
- #pragma warning(disable:4996)
- typedef long long LL;
- typedef unsigned long long ULL;
- #define MAX(a,b) (((a)>(b))?(a):(b))
- #define SETBIT(gpio,bit) ((gpio)|=(1<<(bit)))
- #define RESETBIT(gpio,bit) ((gpio)&=~(1<<(bit)))
- #define READBIT(gpio,bit) (((gpio)>>(bit))&1)
- #define CROL(X,i,n) ((((X)<<(i))|((X)>>((n)-(i))))&((1ull<<(n))-1ull))
- #define CROR(X,i,n) ((((X)>>(i))|((X)<<((n)-(i))))&((1ull<<(n))-1ull))
- #define CROL64(X,i) (((X)<<(i))|((X)>>(64-(i))))
- #define CROR64(X,i) (((X)>>(i))|((X)<<(64-(i))))
- int main(){
- #ifdef _DEBUG
- FILE *fp = freopen("input.txt", "r", stdin);
- //FILE *fp2 = freopen("output.txt", "w", stdout);
- #endif // _DEBUG
- LL a, b;
- int n;
- ULL x;
- char op;
- while(~scanf("%lld %lld %c %d", &a, &b, &op, &n)){
- n %= 64;
- x = (((ULL)((a&0xffffffffuLL) << 32)) | (ULL)(b & 0xffffffffuLL));
- if(op == 'l'){
- x = CROL(x, n, 64);
- }
- else{
- x = CROR(x, n, 64);
- }
- printf("%d %d\n", (int)((x >> 32)), (int)(x));
- }
- #ifdef _DEBUG
- freopen("CON", "r", stdin);
- //freopen("CON", "w", stdout);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment