开始 2024-08-19 00:00:00

8.19-8.24集训第一天

结束 2024-08-25 23:59:00
Contest is over.
当前 2024-12-22 19:44:41

c题

include

include

include

int n,a2[301],b2[301],t,c[301],i; char a[301],b[301]; int change(char c) {

if(c>='0'&&c<='9')return c-48;
else if(c=='A')return 10;
else if(c=='B')return 11;

} int main() {

scanf("%d %s %s",&n,a,b);
t=std::max(strlen(a),strlen(b));
for(i=0;i<strlen(a);i++)a2[strlen(a)-i]=change(a[i]);
for(i=0;i<strlen(b);i++)b2[strlen(b)-i]=change(b[i]);
for(i=1;i<=t;i++)
{
	c[i]+=(a2[i]+b2[i]);
	c[i+1]+=c[i]/n;
	c[i]%=n;
}
bool ch;
for(i=(t+1);i>0;i--)
{
	if(i==(t+1)&&c[i]==0)continue;
	printf("%d",c[i]);
}
return 0;

}


chenxi1314  •  4个月前

include

include

include


chenxi1314  •  4个月前

阿斯顿法国红酒看来很美味


cx202610315  •  4个月前

比赛已结束。