Start: Jun, 27, 2019 08:30:00
2019年度暑期短学期第二天
End: Jun, 27, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: I
Result: Accepted
Time: 5ms
Memory: 1908kB
Author: 2018212212163
In contest: 1275

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<map>
#include<queue>
#include<vector>
using namespace std;
int main()
{
	int T,m,n;
	long long k,a;
	char s[15];
	scanf("%d",&T);
	while(T--){
		a=0;
		scanf("%s",s);
		scanf("%d %lld",&m,&k);
		for(int i=7;i>=0;i--){
			if(s[i]>='a'&&s[i]<='z') a+=(s[i]-87)*pow(16,7-i);
			else a+=(s[i]-'0')*pow(16,7-i);
		}
		long long ww=a;
		long long w=(a>>(32-m))<<(32-m);
		a-=w;
		a+=(k<<(32-m));
		if(a<268435456) printf("0");
		else if(a<16777216) printf("00");
		else if(a<1048576) printf("000");
		else if(a<65536) printf("0000");
		else if(a<4096) printf("00000");
		else if(a<256) printf("000000");
		else if(a<16) printf("0000000");
		printf("%0x\n",a);
		
	}
}